Auth
Authenticate mid-session to receive user-specific events. Send your JWT token (same as REST API) to upgrade from app-level to user-level auth. Supports re-authentication for token refresh or user switch. Pass resumeFrom (the last eventId processed) to replay user events missed while disconnected; a resumed frame ends the replay. auth_expiring warns before the token expires; auth_expired means the session dropped to app level.
Connect-time auth (deprecated): ?token=eyJ... as a query param alongside appId.
Send
Authenticate mid-session with JWT for user-level events
On success, the connection receives user-specific events (orders, balances). Can be called multiple times to switch users or refresh tokens.
Authenticate · Authenticate user mid-session
{ "action": "authenticate", "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "resumeFrom": "string", "id": "string"}Receive
Connection acknowledgement (sent immediately on connect)
Connected · Connection acknowledged
{ "type": "connected", "appId": "app_demo123", "userId": "usr_xyz789", "protocolVersion": 0, "auth": "browser"}User authentication confirmation
Authenticated · User authenticated
{ "type": "authenticated", "userId": "usr_xyz789", "expiresAt": 0, "id": "string"}Application-level heartbeat event
JSON heartbeat emitted approximately every 30 seconds.
Heartbeat · Heartbeat
{ "type": "heartbeat", "ts": 1710000000000}