Commands
Commands are structured request/response messages - like RPC over WebSockets.
Clients send a named command with a payload, and the server responds. Use commands for things like auth, data fetching, or state updates.
Server: expose a command
.("echo", async () => {
return `echo: ${.}`;
});
Client: send a command
const = await .("echo", "Hello!");
.(); // "echo: Hello!"
Features
- Built-in request/response
- Async/await or sync API
- Structured error handling
- Middleware support (validation, auth, etc.)
- Context includes payload, connection, and metadata
See Server SDK → Commands and Client SDK → Commands for full usage details.
Last updated on