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.

CloudflareWebSocket

interfaz

Lado servidor de un WebSocket con hibernación.

ts
import type { CloudflareWebSocket } from "@meekojs/meeko/cloudflare";

Source code src/cloudflare.ts:127

Declaración #

ts
interface CloudflareWebSocket {
	readonly readyState: number
	send(message: string): void
	close(code?: number, reason?: string): void
	serializeAttachment(value: unknown): void
	deserializeAttachment(): unknown
}

Example #

ts
import type { CloudflareWebSocket } from "@meekojs/meeko/cloudflare";

const openSockets = (sockets: CloudflareWebSocket[]) => sockets.filter((socket) => socket.readyState === 1).length;

Miembros #

readyState #

propiedad sólo lectura

readonly readyState: number

0 conectando, 1 abierto, 2 cerrando, 3 cerrado.

send #

método

send(message: string): void

Envía un mensaje de texto.

close #

método

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

Cierra la conexión.

serializeAttachment #

método

serializeAttachment(value: unknown): void

Guarda el estado que sobrevive a la hibernación (hasta 16.384 bytes serializados).

deserializeAttachment #

método

deserializeAttachment(): unknown

Lee el estado guardado con serializeAttachment.

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/cloudflare.ts