Skip to content
Meeko
Type to search the guides and the API reference. Open it from any page with / or Ctrl K; move with the arrow keys and open a result with Enter.
Get started

Contents

On this page

Not translated yet

This page has not been translated into English yet, so it is shown in Spanish.

SocketBroadcaster

interfaz Since 1.2.0

Broadcast tipado de un canal Socket desde el servidor, que añade el registro socket de los clientes de servidor generados (desde 1.2).

ts
import type { SocketBroadcaster } from "@meekojs/meeko/server";

Source code src/server/socket/runtime.ts:586

Declaración #

ts
interface SocketBroadcaster<C extends SocketContract> {
	broadcast<K extends keyof C['serverToClient'] & string>(roomId: string, event: K, payload: SchemaInput<C['serverToClient'][K]>): Promise<void>
}

Type parameters #

C extends SocketContract

Contrato público del canal.

Example #

ts
import type { SocketBroadcaster } from "@meekojs/meeko/server";

declare const kitchen: SocketBroadcaster<typeof socketContracts.operations>;
await kitchen.broadcast("store-12", "kitchenChanged", { orderId: "A-31", status: "ready" });

Miembros #

broadcast #

método

broadcast<K extends keyof C['serverToClient'] & string>(roomId: string, event: K, payload: SchemaInput<C['serverToClient'][K]>): Promise<void>

Publica event en la sala roomId del canal con las mismas comprobaciones que hub.broadcast: rechaza con UNKNOWN_SOCKET_EVENT (404), INVALID_SOCKET_PAYLOAD (400) o SOCKET_LIMIT_EXCEEDED (413) antes de publicar, y se resuelve cuando el broker acepta el mensaje. Las conexiones sin sala usan "".

See also #

Was this page helpful?

Add a comment

It is sent when you choose “Yes” or “No”. Only the page, your answer and the comment are stored: no cookies and no personal data.

0 of 2000 characters

Edit on GitHub: packages/meeko/src/server/socket/runtime.ts