Real-time Sync

Multiplayer by
Default.

Stop managing WebSocket fleets. Rivet Actors give you instant, stateful rooms for collaborative documents, whiteboards, and chat.

document_room.ts
1import { actor } from "rivetkit";
2
3export const docRoom = actor({
4 // State held in RAM for < 1ms access
5 state: { content: "", cursors: {} },
6
7 actions: {
8 // Handle keypresses instantly
9 update: (c, patch) => {
10 c.state.content = applyPatch(c.state.content, patch);
11
12 // Broadcast to all other clients in room
13 c.broadcast("patch", patch);
14 },
15
16 // Ephemeral state for presence
17 moveCursor: (c, { x, y }) => {
18 c.state.cursors[c.connectionId] = { x, y };
19 c.broadcast("presence", c.state.cursors);
20 }
21 }
22});

Room-Based Architecture

Every document or session gets its own dedicated Actor. This isolates state, prevents database contention, and guarantees order of operations.

ACTOR: room-8392
User A
User B

Instant Presence

Broadcast cursor positions and selection states to 100+ users in the same room with <10ms latency.

Authoritative State

The Actor holds the "source of truth" in memory. Resolve conflicts on the server or relay operations for client-side CRDT merging.

Connection Limits

Automatically scales to handle thousands of concurrent active rooms. Each room hibernates when the last user leaves.

The Engine for Collaboration

Primitives designed for high-concurrency, low-latency interactive apps.

WebSockets Included

No need for Pusher or separate socket servers. Actors speak WebSocket natively. Just connect() and listen.

Broadcast & Pub/Sub

Send a message to everyone in the room, or target specific users. Built-in channels for effortless event routing.

Ephemeral Storage

Perfect for 'who is typing' indicators or selection highlights that don't need to be saved to the database.

Conflict Resolution

Run logic on the server to validate moves or merge edits before they are broadcast to other players.

History & Replay

Keep a running log of actions in memory. Allow users to undo/redo or replay the session history.

Yjs & Automerge

A perfect host for CRDT backends. Store the encoded document state in the Actor and sync changes effortlessly.

Ideal For

Infinite Canvases

Build the next Figma or Miro. Store thousands of vector objects in memory and stream updates only for the viewport.

  • Spatial Indexing: Query objects by x/y coordinates
  • Delta Compression: Only send changed attributes
  • Locking: Prevent two users from moving the same object
Sarah

Integrates with

Y.js
Automerge
Prosemirror
Tldraw
Excalidraw
Liveblocks Client

Ready to go multiplayer?

Build the collaborative features your users expect, without the infrastructure headache.