WebSocket Connection
Connection URL
WebSocket connection is created in the following format:
ws://{API_URL}/ws?room_id={room_id}&name={playerName}¤cy={currency}&launch_url_token={token}&token={inGameToken}
Query Parameters:
room_id(string, required): Room IDname(string, required): Player namecurrency(string, required): Currency (e.g., "USD")launch_url_token(string, required): Token from URLtoken(string, required): In-game authentication token
Example:
ws://{API_URL}/ws?room_id=room-123&name=Player1¤cy=USD&launch_url_token=abc123&token=xyz789
Connection States
WebSocket connection emits the following events:
SOCKET_CONNECTING: ConnectingSOCKET_CONNECTED: Connection successfulSOCKET_RECONNECT: ReconnectedSOCKET_MESSAGE: Message receivedSOCKET_ERROR: Error occurredSOCKET_CLOSE: Connection closedSOCKET_DISCONNECT: Connection disconnected
Auto-Reconnect
WebSocket has automatic reconnection capability:
- Automatically attempts to reconnect when connection is closed
- Reconnect delay: 1000ms (default)
- Controlled by
autoReconnectflag