C++ APISession methods
set_session_resumption_enabled
Enables or disables automatic session resumption after unexpected connection loss.
set_session_resumption_enabled(bool is_enabled) controls whether the library
should try to resume the same websocket session automatically after unexpected
connection loss.
Function variants
void set_session_resumption_enabled(bool is_enabled);No network I/O here
set_session_resumption_enabled is local session configuration. It does not
send an API packet and does not connect, reconnect, or disconnect the
session by itself.
Parameters
Prop
Type
Result
void| Type | Meaning |
|---|---|
void | No return value. The setting is applied immediately to the current blaze::session object. |
Behavior notes
- Session resumption is enabled by default.
trueallows automatic resumption attempts after transport-level connection loss.falsedisables automatic resumption. On connection loss, the session goes through normal shutdown instead.- This setting affects future connection-loss events only.
- If resumption is disabled,
set_connection_resumed_callback(...)will never fire for that session instance. - With resumption enabled, valid server-side session state can be restored, including current authorization state and panel-events subscription state.
Example
Compilation note
This example compiles in the same form from C++14 to C++26.
#include "blazeauth/api/api.hpp"
#include <iostream>
int main() {
blaze::session session;
session.set_session_resumption_enabled(true);
std::cout << "Automatic session resumption enabled\n";
// Later, if your application prefers a hard reconnect model:
session.set_session_resumption_enabled(false);
std::cout << "Automatic session resumption disabled\n";
return 0;
}