| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 4 个月前 | ||
| 4 个月前 | ||
| 7 个月前 | ||
| 7 个月前 | ||
| 10 个月前 | ||
| 9 个月前 | ||
| 5 天前 | ||
| 9 个月前 | ||
| 9 个月前 | ||
| 4 个月前 | ||
| 1 年前 |
Real-time Collaborative Cursors (Raw WebSocket)
Demonstrates real-time cursor tracking and collaborative canvas using raw WebSocket handlers instead of RivetKit's higher-level WebSocket abstraction.
Getting Started
git clone https://github.com/rivet-dev/rivet.git
cd rivet/examples/cursors-raw-websocket
npm install
npm run dev
Features
- Raw WebSocket handlers: Use
onWebsocketfor low-level WebSocket control and custom protocols - Real-time cursor tracking: Broadcast cursor positions to all connected users instantly
- Persistent canvas state: Text labels automatically saved in actor state across sessions
- Multiple rooms: Each room is a separate actor instance with isolated state
Implementation
This example demonstrates low-level WebSocket handling for real-time collaboration:
- Actor Definition (
src/backend/registry.ts): Uses rawonWebsockethandler for custom WebSocket protocol implementation
Resources
Read more about WebSockets, state, and events.
License
MIT