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 caseEvent BrokerState Broker
Chat and commentsmessages, historywho's online, who's typing
Collaborative tools (boards, editors)activity feeditems, fields, cursors, selections
Multiplayer and turn-based gamesmoves, dice rolls, game logboard position, turn, players
Live dashboards and order trackingstatus changes as they occurlatest value per order, device, KPI
Notificationsone event per notificationunread counters
Polls, scoreboards, auctions—votes, scores, current bid
IoT and telemetryreadings, alertslast 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, …   │
                                                                      └──────────────────┘
  1. Your App Key (a secret) stays on your server. Browsers ask your server for a token.
  2. Your server exchanges the App Key for a token that expires within seconds or minutes.
  3. 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#

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