Connection
Every WebSocket close code your client may observe and what to do about it.
When the server closes your WebSocket, it does so with a standard WebSocket close code. Most disconnects you observe will be transient network events and will not carry a server close code at all; the ones that do are listed here.
Server-initiated close codes
| Code | Reason | What it means | What to do |
|---|---|---|---|
1008 | customer_unknown | Your account record was missing when we tried to bind your session. Usually means the account configuration changed | Mint a new token and reconnect once. If it repeats, contact us |
Standard WebSocket codes
You may also observe these codes from the underlying network layer:
| Code | Meaning | What to do |
|---|---|---|
1000 | Normal closure | The peer closed the connection cleanly. Reconnect if you still need the stream |
1001 | Going away | The peer is shutting down or navigating away. Reconnect with backoff |
1006 | Abnormal closure | The connection dropped without a close frame (network or proxy issue). Reconnect with backoff |
1011 | Internal error | Something failed on the upstream path. Reconnect with backoff |
For any of these, the reconnect flow is the same: backoff, mint a fresh token, open a new WebSocket. See Reconnection.
Errors that close the connection before it opens
Some failures happen at the HTTP upgrade step, before the WebSocket exists. Those return an HTTP status code with a JSON error body:
| HTTP | Body | When |
|---|---|---|
401 | {"error":"missing_token"} | No token query parameter |
401 | {"error":"invalid_token"} | Token is unknown or expired |
403 | {"error":"forbidden_ip"} | Source IP is not in your allowlist (see IP allowlist) |
These are not WebSocket close codes; treat them as HTTP errors during the upgrade attempt and address the cause before retrying.