Skip to content

Realtime Stream

Bookmarks provides realtime club events over websocket using Durable Objects.

  • GET /v1/clubs/:clubId/stream
  • Authenticated user.
  • User must be a member of :clubId.
  • Request must include websocket upgrade headers.

If request is not a websocket upgrade, API returns 426.

  • HTTP request is forwarded to the club’s DiscussionRoom Durable Object.
  • Each club has an isolated room stream.
  • Connection auth is established before handoff.

The API publishes events to the room for mutations such as:

  • Club updates: member joined/updated/removed, settings changed
  • Notes: created/updated/deleted, comment created/updated/deleted, reaction created, asset deleted
  • Meetings: created/updated/canceled/deleted, RSVP updated, meeting comments created/updated/deleted
  • Sections/books: note section created, book state/rating changes

Event payloads include:

  • type
  • clubId
  • at (ISO timestamp)
  • payload (event-specific fields)
  • Reconnect with backoff on disconnect.
  • On reconnect, refresh canonical state via REST (/books, /meetings, /notes) before applying new events.
  • Treat websocket events as near-realtime hints; REST remains source of truth.
  • Non-members receive 403.
  • Missing auth receives 401.
  • Durable Object/network interruptions can drop connections; clients should auto-retry.