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.

SocketPeer

interfaz

Conexión WebSocket ya aceptada por el adaptador, tal como la ve el hub.

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

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

Declaración #

ts
interface SocketPeer {
	send(message: string): void | Promise<void>
	close(code?: number, reason?: string): void
	readonly bufferedAmount?: number
}

Example #

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

function peerOf(socket: WebSocket): SocketPeer {
  return {
    send: (message) => socket.send(message),
    close: (code, reason) => socket.close(code, reason),
    get bufferedAmount() { return socket.bufferedAmount; },
  };
}

Miembros #

send #

método

send(message: string): void | Promise<void>

Envía un mensaje de texto.

close #

método

close(code?: number, reason?: string): void

Cierra la conexión con un código y un motivo.

bufferedAmount #

propiedad sólo lectura opcional

readonly bufferedAmount?: number

Bytes salientes pendientes, para aplicar maxBufferBytes.

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