Socket SDK Connection

Access via socket.connection.

Methods

MethodReturnsDescription
connect()PromiseOpen the WebSocket
disconnect()voidClose the connection
ping()Promise<number>RTT in milliseconds
isConnected()booleanCurrent state
on(event, handler)voidSubscribe to events

Events

EventPayload highlights
initialized
connectingattempt
openedTransport open
connectedconnectionId, connectionDetails
disconnected
closingIntentional close
closedcode, reason
failederror, context
socket.connection.on("connected", ({ connectionId }) => {
  console.log(connectionId);
});

Conceptual guide: Connection Lifecycle.