folkwaysDocs
Console

Publishable keys

Let a public, read-only app connect without a backend, with a key it trades for anonymous tokens.

A publishable key lets an app with no backend, such as a public scoreboard or a status page, connect to Folkways. The app trades the key for an anonymous, read-only token and connects with that. The key ships inside your app, so everything it grants is public.

A publishable key canIt can't
Grant subscribe (and history) on the topics you choosePublish, set values or send signals
Issue anonymous tokens, up to 15 minutes eachName a user

If users sign in to your app, use a signing key and tokens from your backend instead.

Create one

  1. In the segment's Settings, turn on Allow anonymous connections. Without it, the key's tokens are refused.
  2. On Publishable keys, choose Add key.
  3. Name it, e.g. "Public scoreboard", and set What it may read: topic patterns such as scores/>.
  4. Optionally set an expiry date. After it, the key stops working and no token it issued outlives it.
  5. Save and copy the key into your app.

Pause, resume and revoke

ActionEffect
PauseNew exchanges are refused with Suspended, and connections using the key's tokens close within about a minute. Resume undoes it
RevokeThe key stops working for good (AuthInvalid), and its connections close within about a minute

To rotate a key: create a new one, ship your app with it, then revoke the old one.

Use it

TypeScript
const client = new Folkways.Realtime({ url: 'https://realtime.folkways.net', publishableKey: PUBLISHABLE_KEY });

On this page