Close codes

WebSocket close codes, close reasons, and when the server sends them.

status (in JSON response) and WebSocket close codes are different things:

  • status describes 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

CodeClose reasonWhen it can be sent
1000"" (empty)Normal server-side session shutdown without API error.
4000internal server errorUnexpected internal server error.
4100disconnected from panelPanel explicitly requested disconnect for this session.
4101application pausedApplication was paused from panel while session was active.
4102application deletedApplication was deleted from panel while session was active.
4200connection is not initializedClient sent any operation before successful Initialize.
4201rate limit hitGlobal per-session traffic rate limit was exceeded. Client packets and WebSocket ping frames both participate in this limit.
4201rate limited, N seconds leftInitialize was attempted while a temporary rate-limit backoff window was still active.
4202session wasn't initialized in 15 seconds after connectionSession did not finish Initialize within timeout window.
4203session was blacklistedBlacklist operation completed and server forcefully ended this session.
4204external ID is blacklistedInitialize detected that client_id is blacklisted.
4205failed to initialize sessionToo many consecutive initialize failures while resolving application by API key.
4300packet does not contain mandatory 'type' and/or 'id' fieldsIncoming message is missing mandatory envelope fields (or cannot be parsed as such).
4301invalid handler type specifiedUnknown request type value was sent.
4302invalid request bodyRequest JSON/body validation failed for selected operation.
4304received unsupported dataNon-text WebSocket frame was sent where text JSON was expected.
4400failed to resume sessionSession resume failed due to an internal resume error.
4401resume ID was not found or it is expiredClient 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.

On this page