API reference › @evolu/common › WebSocket
WebSocket with auto-reconnect.
Core
| Name | Description |
|---|---|
| CreateWebSocketDep | Dependency wrapper for CreateWebSocket. |
| WebSocket | WebSocket with auto-reconnect. |
| WebSocketOptions | Options for creating WebSocket. |
| CreateWebSocket | Task that creates a WebSocket. |
| WebSocketReadyState | WebSocket connection states. |
| createWebSocket | Create a new WebSocket. |
| webSocketReconnectSchedule | Default WebSocket reconnect schedule. |
Errors
| Name | Description |
|---|---|
| WebSocketConnectError | An error that occurs when a connection cannot be established due to a network error. Fires before onclose. |
| WebSocketConnectionCloseError | An error that occurs when the connection is closed by the server. |
| WebSocketConnectionError | An error that occurs when an established connection encounters an issue (e.g., failure to send data). Fires before onclose. |
| WebSocketSendError | An error that occurs when trying to send data but WebSocket is not available or is in the CONNECTING state. |
| WebSocketError | Any error reported by a WebSocket, including exhausted reconnect retries. |
| WebSocketRetryError | Errors that trigger a reconnect attempt under webSocketReconnectSchedule. |
Testing
| Name | Description |
|---|---|
| TestCreateWebSocket | An inspectable in-memory CreateWebSocket for testing by testCreateWebSocket. |
| TestSetupWebSocket | A native WebSocket prepared for integration tests by testSetupWebSocket. |
| testCreateWebSocket | Creates TestCreateWebSocket. |
| testSetupWebSocket | Opens a native WebSocket and returns TestSetupWebSocket. |