Skip to main content
The SDK is an explicit state machine. You drive it through well-defined steps, and every step reports its result through stable errors and status.

The lifecycle

Initialize

Parsing and validating configuration happens here. Invalid configuration fails fast — nothing is sent over the network.
Web (browser):
Once initialized the SDK reports Stopped. Nothing is scheduled until start.

Start

Starts the worker machinery (event flush scheduler, realtime poller, wallet stream). In Threaded runtime mode a background thread is spawned; in Manual mode you drive progress by calling tick.

Authenticate

Exchanges credentials (or a persisted token) for a backend session. See Authentication.
The SDK owns the resulting credentials: access token, refresh token, expiry, session id. Your game never touches the raw tokens.

Refresh

The SDK rotates tokens automatically when the access token nears expiry, using POST /api/v1/auth/validate with the refresh token. You can also trigger a manual refresh:

Logout

Revokes the server-side session and clears local credentials.

Shutdown

Releases the runtime. shutdown_timeout_ms (default 5000 ms) bounds the graceful drain before resources are freed.
shutdown is idempotent and safe to call from any thread.

Runtime options

Single-threaded engines (Unity, Godot main thread, web) generally prefer Manual, letting the SDK process bounded work per frame.
The blocking variants of SDK calls run on their own current-thread runtime. Do not call blocking variants from inside another Tokio runtime context.
Last modified on September 10, 2026