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
| Status | Constant | Returned when |
|---|---|---|
1 | Ok | Initialization completed successfully. |
2 | InvalidAPIKey | websocket_api_key length is not exactly 21 characters. |
4 | AlreadyInitialized | Session is already initialized and Initialize was called again. |
6 | InternalServerError | Initialization failed due to an internal server error. |
602 | AppSessionsQuotaExceeded | Current number of authorized sessions is greater than or equal to the application plan limit. |
500 | ClientIDTooShort | client_id is shorter than 4 characters. |
501 | ClientIDTooLong | client_id is longer than 64 characters. |
503 | ClientIDBlacklisted | client_id is blacklisted for the application. The connection may be closed with code 4204. |
600 | AppNotFound | No application was found for the provided websocket_api_key. |
601 | AppPaused | Application 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 code | Error | When it happens |
|---|---|---|
4201 | rate limit hit | Initialization is rejected because session-level throttling is already active before the operation can complete. |
4204 | external ID is blacklisted | client_id is blacklisted. |
4205 | failed to initialize session | More than 3 consecutive failures while resolving app by API key. |