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.

ServerAppSocket

interfaz

Socket de una aplicación con canales: lo que necesita un adaptador para aceptar conexiones.

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

Source code src/server/runtime/app.ts:244

Declaración #

ts
interface ServerAppSocket {
	readonly hub: SocketHub
	readonly pathnamePrefix: string
	readonly maxMessageBytes?: number
	readonly pubsub?: SocketPubSub
	readonly sessionCookieName?: string
}

Example #

ts
if (app.socket) {
  const { hub, pathnamePrefix } = app.socket;
  await hub.broadcast("chat", "general", "message", { text: "Mantenimiento en 5 minutos" });
  console.log(`Socket en ${pathnamePrefix}/<canal>`);
}

Propiedades #

hub #

propiedad sólo lectura

readonly hub: SocketHub

Hub que valida y reparte los mensajes.

pathnamePrefix #

propiedad sólo lectura

readonly pathnamePrefix: string

Prefijo de las rutas de los canales, /_meeko/socket.

maxMessageBytes #

propiedad sólo lectura opcional

readonly maxMessageBytes?: number

Tamaño máximo de un mensaje entrante en bytes.

pubsub #

propiedad sólo lectura opcional

readonly pubsub?: SocketPubSub

Broker del hub; no existe cuando usa su propio LocalSocketPubSub.

sessionCookieName #

propiedad sólo lectura opcional

readonly sessionCookieName?: string

Nombre de la cookie de sesión, para hosts que sólo conservan esa cookie con la conexión.

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/runtime/app.ts