Clients
The production client.
FirstPartyTransport talks to api.lokiplay.cc. The public API never returns Nakama types.
npm install @lokiplay/sdk@0.3.8
import { LokiClient, FirstPartyTransport } from "@lokiplay/sdk";
const client = new LokiClient({
projectId,
transport: new FirstPartyTransport(),
});
await client.authenticate(token);
| Method | Purpose |
|---|---|
authenticate(token) | Bind a player session |
createRoom() | Host a room; receive inviteCode |
joinRoom({ inviteCode }) | Join |
matchmake({ minPlayers, maxPlayers, teamSize? }) | Fill a room |
createSynchronizedRoom(options) | Lockstep room |
createRealtimeRoom(options) | Streaming room |
createHostedLokiClient(options) | Hosted play-page client |
calibrateRealtimeRoom(options) | Pick a RealtimeProfile from evidence |
sendChat(text, channel?) | lobby or match |
submitScore(id, score, subscore?) | Private board |
leaveRoom() | Intentional leave |
reconnect() | Replace socket + snapshot |
close() | Abandon the handle |
projectId must be a UUID. playerId, roomId, and inviteCode are read-only on the client. A production build must not target localhost.