Sdks
TypeScript SDK
Client API for connect, rooms, state, RPC, and matchmaking.
TypeScript SDK
Package: @triformine/nexis-sdk
Create and connect client
async function (: string, : string, : string) {
const = await (, { , });
const = await .("counter_plugin_room", { : "default" });
.(() => {
.("state update", );
});
}NexisClient methods
connect(url, { projectId?, token? })NexisClient.connect(url, { projectId?, token? })joinOrCreate(roomType, options)listRooms(roomType?)enqueueMatchmaking(roomType, size)dequeueMatchmaking()onMatchFound(cb)sendRPC(type, payload)onEvent(type, cb)
NexisRoom methods
room.stateroom.onStateChange(cb)room.onStateChange.once(cb)room.onStateChange.select(path, cb)room.send(type, payload)room.sendBytes(type, bytes)room.onMessage(type, cb)
Custom message types
You can send any room message type name:
("player.move", { : 12, : 4, : 91 });
("weapon.fire", { : "smg", : 12345 });In room/plugin logic, handle via input.type and input.data.
RPC usage
async function () {
const = await .<>("room.join_or_create", {
: "counter_plugin_room",
: "default",
});
.(., .);
}RPC is for request/response workflows.
room.send is for gameplay action/event streams.
Quality checks
- patch apply
- codec encode/decode (json + msgpack)
- RPC resolution and unknown-rid guard
- room message byte helpers
Run:
cd sdks/ts
bun test
bunx tsc -p tsconfig.json --noEmit