Quickstart
First connection without a controller: create an explicit mock, subscribe before connect and start the session separately.
Sequence
Register handlers first. connect() resolves after an accepted server.hello, not merely an open socket. Load critical images, audio and scene content next. Call ready() only after loading. The session.start event controls game time; completion of ready does not start gameplay.
Check
Place the snippet in an ES module next to the src directory. It prints a normalized impact and explicitly simulates session start. For a complete runnable interface use examples/canvas-demo. The controls object exists only in the mock adapter; it is not an API for operating a real Launcher.
Next
Replace coordinate logging with scoring, add a pause guard and complete once. For real connectivity instantiate VorivoxClient with a trusted manifest; never replace the loopback bridge with an arbitrary Cloud URL.
Code example
Integration excerpt: game-specific variables belong to the application. Playground contains the runnable reference.
import {createMockSdk} from './src/mock.js';
const {sdk, controls} = createMockSdk();
sdk.on('target.hit', hit => {
if (sdk.sessionState !== 'running') return;
console.log(hit.nx, hit.ny); // no manifest or session token
});
await sdk.connect();
// Load required assets here; do not report readiness early.
await sdk.ready('FirstGame');
controls.start();
controls.hit(0.5, 0.5);
// Call sdk.disconnect() when this development example is disposed.