[]previous and next page

WebSocketSink

Where the connection writes its frames: the transport of the runtime.

Where the connection writes its frames: the transport of the runtime.

Import#

ts
import type { WebSocketSink } from "@shadow-js/dusk/server";

Signature#

ts
interface WebSocketSink {
  /** Writes bytes (frames) to the peer, in order. */
  write(bytes: Uint8Array): void;
  /** Ends the transport. Called once, after the last frame. */
  end(): void;
  /**
   * Bytes written and not yet taken by the peer (Node: `socket.writableLength`). When the transport reports it, a
   * connection whose unsent bytes pass `maxBufferedBytes` is dropped instead of buffered without bound.
   */
  buffered?(): number;
  /** Drops the transport at once, without flushing what is unsent (Node: `socket.destroy()`). */
  destroy?(): void;
}

Members#

Name Type Description
write write(bytes: Uint8Array): void Writes bytes (frames) to the peer, in order.
end end(): void Ends the transport. Called once, after the last frame.
buffered? buffered?(): number Bytes written and not yet taken by the peer (Node: socket.writableLength). When the transport reports it, a connection whose unsent bytes pass maxBufferedBytes is dropped instead of buffered without bound.
destroy? destroy?(): void Drops the transport at once, without flushing what is unsent (Node: socket.destroy()).