Packets

Initialize

Initializes a websocket session with application context and client identity.

Initialize binds the current websocket connection to your application and client. Until this packet succeeds, other API operations are blocked.

Time limit

A new connection must be initialized within 15 seconds. If no successful initialization happens in time, the server closes the socket with code 4202.

Request

Initialize uses packet type = 0.

{
  "type": 0,
  "id": 1,
  "websocket_api_key": "BA0123456789ABCDEFGHI",
  "client_id": "desktop-main"
}

Prop

Type

Response

{
  "id": 1,
  "app_name": "Blazeauth Demo",
  "app_version": "1.0.0",
  "status": 1
}

Prop

Type

Initialize Statuses

StatusConstantReturned when
1OkInitialization completed successfully.
2InvalidAPIKeywebsocket_api_key length is not exactly 21 characters.
4AlreadyInitializedSession is already initialized and Initialize was called again.
6InternalServerErrorInitialization failed due to an internal server error.
602AppSessionsQuotaExceededCurrent number of authorized sessions is greater than or equal to the application plan limit.
500ClientIDTooShortclient_id is shorter than 4 characters.
501ClientIDTooLongclient_id is longer than 64 characters.
503ClientIDBlacklistedclient_id is blacklisted for the application. The connection may be closed with code 4204.
600AppNotFoundNo application was found for the provided websocket_api_key.
601AppPausedApplication exists but is paused.

Connection-close cases (no normal response packet)

Some initialization failures are returned as websocket close errors, not as a regular JSON response with status.

Close codeErrorWhen it happens
4201rate limit hitInitialization is rejected because session-level throttling is already active before the operation can complete.
4204external ID is blacklistedclient_id is blacklisted.
4205failed to initialize sessionMore than 3 consecutive failures while resolving app by API key.

On this page