Stockbit Research research Playground @hansputera

General WebSocket (ws-gen.stockbit.com/v1)

Connection

wss://ws-gen.stockbit.com/v1

Authentication

Uses a different auth flow: - Obtain securities token: cp.Z.getSecuritiesToken().securitiesAccessToken - Connection is re-established with exponential backoff (up to 10 * 3 retries) - Ping interval is configurable (default: ~6 seconds)

Protocol

Messages use the same WebsocketRequestWebsocketWrapMessage pattern.

The WebSocket implements: - Automatic reconnection with backoff (1x, 2x, 3x, ... up to 10 attempts) - Ping/pong heartbeat - Token refresh on 401

Connection States

UNINSTANTIATED  OPEN  CLOSED  (reconnect)  OPEN
                   (offline)  wait  reconnect

Heartbeat

Ping is sent every ~6 seconds. If no response for 3+ intervals, the connection is considered dead and reconnected.

Error Handling