C++ session lifecycle
Connect, initialize, authenticate, keep alive, and reconnect correctly.
C++ session lifecycle
Blazeauth connections are session-based. A typical client keeps one WebSocket open, sends requests through that socket, and restores state after reconnect.
Recommended lifecycle
Open a WebSocket connection to wss://eu1.blazeauth.net.
Send initialize as the first request. Until it succeeds, all other requests are undefined.
Choose one flow: auth_by_license or auth_by_credentials.
Call reference operations (variables, files, session values) depending on your needs.
Send ping periodically while the application is active.
After a disconnect, reconnect and repeat: connect → initialize → authenticate (if your features require it).
Reconnect strategy
Treat reconnect as a fresh session
If the socket is closed, consider all client-side Blazeauth state invalid until you reconnect and re-run initialize.
A robust strategy usually includes:
- exponential backoff with a maximum delay
- a cap on parallel reconnect attempts (exactly one is recommended)
- a clean state reset before re-authentication