← Use cases

Private channels and live chat without a backend

For Webflow, Framer, static sites and Supabase or Firebase apps: private notifications, live chat and an online list, through a ready-made Cloudflare Worker that checks the login you already have.

Plenty of sites have no backend of their own: a Webflow or Framer page, a static site, a Jamstack shop, or a mobile app that signs in with Supabase or Firebase. Public channels work there, but anything only one person should see, or anything a visitor sends, needs a server that knows who they are and holds your app secret. Writing and hosting that server just for realtime is usually what stops the feature. Our ready-made Cloudflare Worker is that server: you deploy it to your own Cloudflare account in one click, it checks the login you already have, and your page talks to it directly.

What your users get

  • Notifications only they can see: "your order shipped", "someone replied to you", the moment it happens.
  • A live chat or Q&A next to a livestream, with the list of who's here.
  • "Kai is typing…" and other small live hints between visitors.
  • The same features in your mobile app, signed in with the account they already use.
A live tasting on a static page: messages go through the Worker's /publish, and "Kai is typing…" is a client event. Both views are connected to the same channel.
A live tasting on a static page: messages go through the Worker's /publish, and "Kai is typing…" is a client event. Both views are connected to the same channel.

Who it helps

Step 1: deploy the Worker

Press Deploy to Cloudflare and enter your app key and secret, your login's public keys and which channels a user may join. Open the Worker's address afterwards: its setup page shows whether anything is missing.

HIBIRA_KEY      your app key
HIBIRA_SECRET   your app secret (stored as a secret)
JWKS_URL        https://YOUR-APP.clerk.accounts.dev/.well-known/jwks.json
CHANNELS        private-user-{id},presence-*
PUBLISH         presence-room-*
PUBLISH_EVENTS  message
HIBIRA_APP_ID   your app ID

Step 2: point your page at it

const auth = 'https://hibira-channel-auth.YOUR-SUBDOMAIN.workers.dev';
const headersProvider = () => ({ Authorization: `Bearer ${getToken()}` });

const pusher = new Pusher('YOUR_APP_KEY', {
  cluster: 'hkg',
  wsHost: 'ws.hibira.io',
  forceTLS: true,
  enabledTransports: ['ws', 'wss'],
  channelAuthorization: { endpoint: `${auth}/pusher/auth`, headersProvider },
});

pusher.subscribe(`private-user-${userId}`).bind('order.shipped', showToast);

getToken() returns your login's current token, such as await clerk.session.getToken() or the Supabase session's access_token.

Step 3: send messages

Subscribing needs no backend now, and neither does sending. Pick the way that fits what you send:

Client events go straight from one browser to the others on the channel. Turn on Client events in your app's settings first. Nothing checks what they say, so keep them for things that are fine to miss.

const room = pusher.subscribe('presence-room-1');
room.trigger('client-typing', { name: 'Mei' });
room.bind('client-typing', (data) => showTyping(data.name));

The Worker's /publish is for messages that need to be trusted. The Worker checks the login token and your rules, then fills in data.sender from the token, so nobody can post as someone else.

await fetch(`${auth}/publish`, {
  method: 'POST',
  headers: { 'Content-Type': 'application/json', ...headersProvider() },
  body: JSON.stringify({ channel: 'presence-room-1', event: 'message', data: { text: 'Hello' } }),
});

room.bind('message', ({ text, sender }) => addMessage(sender.name, text));

From your data. When a message starts with a change in your data, such as an order that ships, send it from where that change happens: a Supabase Edge Function or Firebase Cloud Function with a Pusher server library, or the Hibira nodes for n8n, Make, Activepieces and Node-RED. See the Supabase guide for a full example.

Tips

  • Each user may send 20 messages a minute through /publish; change it in the Worker's wrangler.jsonc.
  • With guest mode on, guests can send too, but only to the channels your rules allow, and always as guest- IDs.
  • The Workers free plan covers 100,000 requests a day. Each subscription to a private or presence channel and each /publish is one request; messages count against your Hibira plan as usual.
  • Want typing hints and an online list in a full chat? See chat with typing indicators. The Cloudflare Workers guide lists every setting.