API reference@evolu/common › WebSocket

WebSocket with auto-reconnect.

Core

NameDescription
CreateWebSocketDepDependency wrapper for CreateWebSocket.
WebSocketWebSocket with auto-reconnect.
WebSocketOptionsOptions for creating WebSocket.
CreateWebSocketTask that creates a WebSocket.
WebSocketReadyStateWebSocket connection states.
createWebSocketCreate a new WebSocket.
webSocketReconnectScheduleDefault WebSocket reconnect schedule.

Errors

NameDescription
WebSocketConnectErrorAn error that occurs when a connection cannot be established due to a network error. Fires before onclose.
WebSocketConnectionCloseErrorAn error that occurs when the connection is closed by the server.
WebSocketConnectionErrorAn error that occurs when an established connection encounters an issue (e.g., failure to send data). Fires before onclose.
WebSocketSendErrorAn error that occurs when trying to send data but WebSocket is not available or is in the CONNECTING state.
WebSocketErrorAny error reported by a WebSocket, including exhausted reconnect retries.
WebSocketRetryErrorErrors that trigger a reconnect attempt under webSocketReconnectSchedule.

Testing

NameDescription
TestCreateWebSocketAn inspectable in-memory CreateWebSocket for testing by testCreateWebSocket.
TestSetupWebSocketA native WebSocket prepared for integration tests by testSetupWebSocket.
testCreateWebSocketCreates TestCreateWebSocket.
testSetupWebSocketOpens a native WebSocket and returns TestSetupWebSocket.