Skip to content

WebSocketManager ​

WebSocket connection manager Access via websocket.connect()

Methods ​

connect() ​

javascript
connect(url: string, options: Array<any>): WebSocket

Create a new WebSocket connection

Parameters:

  • url (string) - WebSocket URL (ws:// or wss://)
  • options (Array<any>) - Connection options
    • protocols: Array of subprotocols
    • headers: HTTP headers dictionary
    • reconnectInterval: Seconds between reconnect attempts (default: 2)
    • maxReconnectAttempts: Maximum reconnection attempts (default: 5)

Returns: WebSocket