colyseus-rs-client
v0.1.0
Published
TypeScript client for colyseus-rs game servers: matchmaking, rooms and state sync
Readme
colyseus-rs-client
TypeScript client for colyseus-rs game servers: HTTP matchmaking, binary MessagePack frames over WebSocket, and room state sync via JSON-Patch (RFC 6902).
Install
npm install colyseus-rs-clientUsage
import { Client } from "colyseus-rs-client";
const client = new Client("http://localhost:2567");
const room = await client.joinOrCreate("game", { mode: "ranked" });
room.onStateChange((state) => render(state));
room.onMessage("chat", (msg) => console.log(msg));
room.send("move", { vx: 1, vy: 0 });
// reconnection: keep the token and call client.reconnect(room)Public room listings (server-side filtered/paged query):
const page = await client.rooms((q) =>
q.name("trivia").where("clients", "lt", 2).sort("createdAt", "desc").limit(20),
);For the server administration API (room inspect/dispose, custom admin RPCs), see colyseus-rs-admin.
License
MIT
