What is Mesh?
Mesh is a command-based WebSocket framework for real-time apps. It uses Redis to coordinate connections, rooms, presence, and shared state across distributed servers—with built-in support for structured commands, latency tracking, and automatic reconnection.
Core Concepts
Mesh is built from a small set of primitives. Each one is simple, but together they let you build powerful real-time systems.
Quickstart
Here’s the fastest way to get a server and client talking.
1. Install the package
npm install @mesh-kit/core
2. Start a Redis server (if needed)
docker run -p 6379:6379 redis
3. Create a server
import { MeshServer } from "@mesh-kit/core/server";
const server = new MeshServer({
port: 8080,
redisOptions: { host: "localhost", port: 6379 },
});
server.exposeCommand("echo", async (ctx) => {
return `echo: ${ctx.payload}`;
});
4. Connect from a client
import { MeshClient } from "@mesh-kit/core/client";
const client = new MeshClient("ws://localhost:8080");
await client.connect();
const response = await client.command("echo", "Hello!");
console.log(response); // "echo: Hello!"
Who is this for?
Mesh is for the 95% of real-world apps that need real-time sync—but don’t want to build a protocol, socket engine, or multi-server infra from scratch.
Common use cases where Mesh works well:
Collaborative apps
- Live cursors
- Shared documents or boards
- Co-browsing
Dashboards and control panels
- IoT devices
- Live analytics
- Monitoring & alerts
Real-time social features
- Chat and presence
- Typing indicators
- Notification feeds
Async or turn-based games
- Card or strategy games
- Shared inventories and positions
- Multiplayer state syncing
Last updated on