Getting started
Thuum.dev documentation
Real-time events and shared state for your apps, over WebSocket and REST, without running a realtime backend yourself.
Thuum.dev gives your apps two real-time building blocks behind one API:
- the Event Broker for things that happen: chat messages, notifications, activity feeds, telemetry. Publish an event and everyone subscribed receives it, live; a recent history is kept so clients can catch up.
- the State Broker for how things are now: who is online, where a cursor is, the score of a match, the fields of a shared document. Set or patch a value and every subscriber is notified of the change, with a version number to keep them in order.
Browsers connect straight to Thuum over WebSockets with short-lived tokens. Your servers use plain REST (or the same WebSocket protocol) from any language. Access is decided per topic by claims you manage yourself, in the console or through the API.
What you can build#
| Use case | Event Broker | State Broker |
|---|---|---|
| Chat and comments | messages, history | who's online, who's typing |
| Collaborative tools (boards, editors) | activity feed | items, fields, cursors, selections |
| Multiplayer and turn-based games | moves, dice rolls, game log | board position, turn, players |
| Live dashboards and order tracking | status changes as they occur | latest value per order, device, KPI |
| Notifications | one event per notification | unread counters |
| Polls, scoreboards, auctions | — | votes, scores, current bid |
| IoT and telemetry | readings, alerts | last known state of each device |
How it fits your stack#
Text
Browser / mobile app Your backend Thuum.dev
┌────────────────────┐ 1. ask ┌─────────────────┐ 2. App Key ┌──────────────────┐
│ │ ─────────▶ │ token route │ ─────────────▶ │ POST /token │
│ │ ◀───────── │ (your auth) │ ◀───────────── │ │
│ │ token │ │ token │ │
│ │ │ workers, APIs │ ══ REST ══════▶│ publish, set, │
│ │ └─────────────────┘ │ read, configure │
│ │ ═══════ 3. WebSocket ?token=… ═══════════════▶│ sub, pub, set, │
└────────────────────┘ │ merge, tell, … │
└──────────────────┘- Your App Key (a secret) stays on your server. Browsers ask your server for a token.
- Your server exchanges the App Key for a token that expires within seconds or minutes.
- The browser opens a WebSocket with that token, then subscribes, publishes and writes states. Your backend does the same over REST, or over WebSockets for long-running workers.
Every operation is checked against the claims linked to the App Key: which topics it may publish to, subscribe to, read or manage.
Where to start#
- New here? Follow the Quickstart: a token, an event and a
state in five minutes, with
curl, Node.js or the TypeScript client. - Setting up a real app? Set up your Domain with least-privilege keys, then read Connect browsers securely.
- Want to see the wire? Open the Playground: every frame, every REST call, and the code that does it.
- Designing your data? Read Topics, then the Event Broker and State Broker concepts.
Concepts
- How Thuum works
- Topics
- Claims and permissions
- Event Broker
- State Broker
- Security model
WebSocket API
- WebSocket protocol
- Event Broker WebSocket
- State Broker WebSocket
REST API
- REST API overview
- Authentication
- Event Broker REST
- State Broker REST
- Management API
Client library
- @thuum/client
- Sockets
- Client reference
Guides
- Connect browsers securely
- Build reliable clients
- Tutorial: a chat with presence
- Tutorial: a live operations dashboard
- Tutorial: collaborative editing
- Backend integration
Reference
- Limits and defaults
- Errors and troubleshooting