What you get
The parts of realtime that are tedious to build and easy to get wrong.
Channels
Name a channel, publish to it, and every subscribed client receives the message. Send one message to up to 100 channels in a single call.
Missed messages are recovered
A client that drops off and reconnects within 5 minutes receives what it missed, in order.
Presence
See who is connected to a channel right now, and get notified when someone joins or leaves.
Separate apps
Every app has its own API keys and channels. One app can never read or publish to another app's channels.
Short-lived client tokens
Your API key stays on your backend. Clients connect with tokens you issue per user and per channel.
Limits and usage
Set a daily message limit per app and see messages and tokens per day in the admin portal.
How it works
Three steps from a new app to a live message.
-
Create an app
In the admin portal, create an app and copy its API key. The key is shown once.
App ID 3f9a1c2e7b40 API key 3f9a1c2e7b40.a81c….••••••••
-
Issue a token and connect
Your backend asks for a token for one user. The client connects with it and subscribes.
import { Centrifuge } from 'centrifuge'; const client = new Centrifuge(grant.ws_url, { token: grant.token }); const news = grant.subscriptions[0]; const sub = client.newSubscription(news.channel, { token: news.token }); sub.on('publication', (ctx) => show(ctx.data)); sub.subscribe(); client.connect(); -
Publish
One HTTP call from your backend. Everyone on the channel gets the message.
curl -X POST https://dash.websock.dev/v1/publish \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ -d '{"channel": "news", "data": {"text": "hello"}}'