Clients
Boot the hosted client.
The play shell posts loki:init. createHostedLokiClient handles the handshake. Do not write your own listener and wait for a button click.
import { createHostedLokiClient, FirstPartyTransport } from "@lokiplay/sdk";
const client = await createHostedLokiClient({
projectId,
fallbackTransport: new FirstPartyTransport(), // local preview only
});
Reuse that client for every create/join. If the handshake times out and no fallback is configured, the game is not on a Loki play page. Do not fall back to a hardcoded API token in the bundle.
Lower-level access remains on hostedGameSessionProvider(port, nonce) if you must build your own transport.