Skip to content

@epikodelabs/streamix


@epikodelabs/streamix / networking/src/public-api / WebSocketStream

Type Alias: WebSocketStream<T>

WebSocketStream<T> = Atom<T> & object

Defined in: projects/libraries/streamix/networking/src/lib/webSocket.ts:17

A bidirectional stream built on top of WebSocket.

Incoming WebSocket messages are emitted through the stream, while outgoing messages can be sent using WebSocketStream.send.

Type Declaration

send()

send: (message) => void

Sends a JSON-serializable message to the server.

If the socket is still connecting, the message is queued automatically and flushed once the connection opens.

Parameters

message

T

Message payload to send.

Returns

void

close()

close: () => void

Closes the WebSocket connection and terminates the stream.

Any queued outgoing messages are discarded.

Returns

void

Type Parameters

T

T = any

Message payload type.

Released under the GNU AGPL v3 or later.