Close codes
WebSocket close codes, close reasons, and when the server sends them.
status (in JSON response) and WebSocket close codes are different things:
statusdescribes result of one API operation.- close code ends the whole socket session.
Blazeauth uses custom application close codes in the 4000-4499 range.
Close codes and reasons
| Code | Close reason | When it can be sent |
|---|---|---|
1000 | "" (empty) | Normal server-side session shutdown without API error. |
4000 | internal server error | Unexpected internal server error. |
4100 | disconnected from panel | Panel explicitly requested disconnect for this session. |
4101 | application paused | Application was paused from panel while session was active. |
4102 | application deleted | Application was deleted from panel while session was active. |
4200 | connection is not initialized | Client sent any operation before successful Initialize. |
4201 | rate limit hit | Global per-session traffic rate limit was exceeded. Client packets and WebSocket ping frames both participate in this limit. |
4201 | rate limited, N seconds left | Initialize was attempted while a temporary rate-limit backoff window was still active. |
4202 | session wasn't initialized in 15 seconds after connection | Session did not finish Initialize within timeout window. |
4203 | session was blacklisted | Blacklist operation completed and server forcefully ended this session. |
4204 | external ID is blacklisted | Initialize detected that client_id is blacklisted. |
4205 | failed to initialize session | Too many consecutive initialize failures while resolving application by API key. |
4300 | packet does not contain mandatory 'type' and/or 'id' fields | Incoming message is missing mandatory envelope fields (or cannot be parsed as such). |
4301 | invalid handler type specified | Unknown request type value was sent. |
4302 | invalid request body | Request JSON/body validation failed for selected operation. |
4304 | received unsupported data | Non-text WebSocket frame was sent where text JSON was expected. |
4400 | failed to resume session | Session resume failed due to an internal resume error. |
4401 | resume ID was not found or it is expired | Client tried to resume session with invalid/expired Resume-Id. |
Special case
During session takeover (same Resume-Id reconnect), old connection is closed immediately without close handshake (RST termination). In this case, no application close code/reason is guaranteed to be delivered.