folkwaysDocs
Realtime API

Realtime API

The API your apps and backend use to connect, publish, subscribe and manage topics, with every endpoint at a glance.

The Realtime API is what clients connect to. Your apps use it to publish and subscribe; your backend uses it to publish, manage private topics, open direct messages and disconnect users. The JavaScript SDK speaks it for you; this section is for other languages and for anyone who wants to know exactly what happens on the wire.

Base URL

Each segment's Connect tab shows its Realtime URL, for example https://realtime.folkways.net. One host serves every transport over TLS on port 443:

  • WebSocket: wss://realtime.folkways.net/v1/ws
  • HTTP: https://realtime.folkways.net/v1/…

Paths are versioned (/v1). The segment is never in a path or query string: it comes only from the token.

Endpoints

EndpointBodyAuthFor
GET /v1/wsFramesToken in the first frameApps: live publish and subscribe
POST /v1/publishFramesAuthorization: Bearer <token>Publishing without a connection
POST /v1/pollFramesAuthorization: Bearer <token>Receiving where WebSockets are blocked
POST /v1/tokenJSONAuthorization: Bearer <publishable key>Trading a publishable key for an anonymous token
POST /v1/dm/openJSONService tokenOpening a DM or group room
POST /v1/members/addJSONService tokenGranting members ops on a private topic
POST /v1/members/setJSONService tokenSetting one member's ops
POST /v1/members/removeJSONService tokenRemoving members
POST /v1/members/clearJSONService tokenRemoving every member
POST /v1/members/listJSONService tokenListing members
POST /v1/kickJSONService tokenDisconnecting an identity
POST /v1/revokeJSONService tokenRevoking one token

Two kinds of body

  • Frames. The WebSocket, /v1/publish and /v1/poll carry binary packets of FlatBuffers frames: Publish, Subscribe, Deliver and so on. One schema covers all three. See Payload format and the frame reference.
  • JSON. The token, DM, members, kick and revoke endpoints take and return JSON. Errors are { "code", "error", "message" } with an HTTP status.

Errors

Every transport uses the same numbered error codes, such as 203 Forbidden or 300 RateLimited. On a WebSocket they arrive as frames; over HTTP they also set the status code.

Browsers and CORS

/v1/publish, /v1/poll and /v1/token accept requests from any origin, with no cookies. The backend endpoints (DMs, members, kick, revoke) don't allow browsers at all: they need service tokens, which never belong in an app. WebSockets need no CORS.

Building a client

A client in a new language needs:

  1. FlatBuffers bindings generated from the protocol schema;
  2. a token, from your backend or a publishable key;
  3. the WebSocket lifecycle: Hello, pings, token refresh, reconnects;
  4. subscribing with cursors, and saving the last processed cursor per topic.

Build a client in another language walks through a complete Python client, and the client checklist lists what a production client must do.

On this page