Skip to content

Connection

Close codes

View as MarkdownPlain text source(opens in new tab)

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

CodeReasonWhat it meansWhat to do
1008customer_unknownYour account record was missing when we tried to bind your session. Usually means the account configuration changedMint 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:

CodeMeaningWhat to do
1000Normal closureThe peer closed the connection cleanly. Reconnect if you still need the stream
1001Going awayThe peer is shutting down or navigating away. Reconnect with backoff
1006Abnormal closureThe connection dropped without a close frame (network or proxy issue). Reconnect with backoff
1011Internal errorSomething 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:

HTTPBodyWhen
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.