{
"type": "connected",
"appId": "app_demo123",
"userId": "usr_xyz789"
}{
"type": "authenticated",
"userId": "usr_xyz789"
}{
"type": "heartbeat",
"ts": 1710000000000
}{
"action": "authenticate",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}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.
Connect-time auth: Pass ?token=eyJ... as a query param alongside appId.
{
"type": "connected",
"appId": "app_demo123",
"userId": "usr_xyz789"
}{
"type": "authenticated",
"userId": "usr_xyz789"
}{
"type": "heartbeat",
"ts": 1710000000000
}{
"action": "authenticate",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}App-level auth: pass appId as a query parameter on connect. Required for all connections. The appId must belong to an active app with matching allowed origins.
User-level auth: pass JWT as token query param on connect, or send { action: 'authenticate', token } mid-session. Required for user-specific events (orders, balances). Same JWT as the REST API.
Sent immediately after successful connection. Includes userId if JWT was provided on connect.
Confirms successful mid-session authentication
Application-level heartbeat event for connection liveness
Upgrade connection to user-level auth. Uses the same JWT as the REST API. Supports re-authentication for token refresh or user switch.