MessageWebSocketSink
A runtime that exposes complete WebSocket messages and owns their framing.
A runtime that exposes complete WebSocket messages and owns their framing. A ping method opts into Dusk's heartbeat; otherwise the runtime owns heartbeat control frames.
Import#
ts
import type { MessageWebSocketSink } from "@shadow-js/dusk/server";
Signature#
ts
interface MessageWebSocketSink {
/** Sends a message; false means the transport could not send it. */
send(message: string | Uint8Array): boolean;
/** Writes the closing handshake. */
close(code: number, reason: string): void;
/** Ends the connection; safe after a closing handshake. */
end(): void;
/** Bytes queued by the runtime. */
buffered?(): number;
/** Drops the transport immediately. */
destroy?(): void;
/** Sends a native ping, when the runtime exposes that operation. */
ping?(): void;
}
Members#
| Name | Type | Description |
|---|---|---|
send |
send(message: string | Uint8Array): boolean |
Sends a message; false means the transport could not send it. |
close |
close(code: number, reason: string): void |
Writes the closing handshake. |
end |
end(): void |
Ends the connection; safe after a closing handshake. |
buffered? |
buffered?(): number |
Bytes queued by the runtime. |
destroy? |
destroy?(): void |
Drops the transport immediately. |
ping? |
ping?(): void |
Sends a native ping, when the runtime exposes that operation. |