Skip to content
UDX

Close Codes

The WebSocket close codes the exchange sends, what each means, and how to recover.

A close code ends the whole connection. Errors scoped to one command or one subscription arrive as error frames instead, and each operation page lists the codes it can send. Codes in the 1000 range are the standard WebSocket close codes; codes in the 4000 range are specific to the exchange.

CodeMeaning
1000Normal closure; reconnect only when another session is needed.
1001Session lifetime or idle bound expired; reconnect and resubscribe.
1002WebSocket protocol error; fix the client before reconnecting.
1003Unsupported application data; send JSON text messages.
1007Invalid UTF-8; fix the client before reconnecting.
1008Repeated invalid or abusive input; back off and fix the client.
1009Frame too large; send a smaller command.
1011Unexpected server failure; reconnect with backoff and rebuild local state.
1012Service restart, drain, or loss of a shared upstream source; reconnect with backoff and resubscribe. Events between the close and the new subscription are not replayed.
1013Temporary service or admission failure; reconnect with backoff and rebuild local state.
4001Authorization revoked; re-authenticate before reconnecting.
4003Slow consumer or outbound memory bound; repair consumption, reconnect, and rebuild local state. This close frame is best effort, so an abnormal close is equivalent.

After any close, reconnect with backoff, authenticate again, resubscribe, and rebuild state. See Connecting.