Migrate Django from Pusher: the hibira package and pusher-js
Move a Django app off Pusher Channels: swap the pusher package for hibira, rename two calls, add wsHost to pusher-js and switch over without a gap.
A Django app that publishes to Pusher Channels uses the pusher package on the server and pusher-js in its templates. Moving to Hibira keeps pusher-js and your channel names, but swaps the server package: the official pusher package only accepts numeric app IDs, so it refuses Hibira's. The hibira package has the same calls under slightly different names, so the change is a handful of lines.
What changes and what stays
| Part of your app | Changes? | What to do |
|---|---|---|
pusher.Pusher(...) client | Yes | Replace it with hibira.Client(...) |
trigger() and trigger_batch() calls | No | Same names and arguments |
authenticate() in your auth view | Yes | Rename it to authenticate_channel() |
validate_webhook() | Yes | Rename it to verify_webhook() |
| pusher-js in your templates | Yes | Add wsHost and the new key |
| Allowed origins | New | List your domains on the app; the Free plan needs exact origins |
Step 1: swap the client
pip uninstall pusher
pip install hibiraThen create one client, for example in realtime.py:
import hibira
client = hibira.Client.from_env() # HIBIRA_APP_ID, HIBIRA_APP_KEY, HIBIRA_APP_SECRET, HIBIRA_HOST
client.trigger("orders", "order-shipped", {"id": 1024})
client.trigger(["orders", "admin"], "order-shipped", {"id": 1024}, socket_id=socket_id)In async views or with Django's async ORM, use hibira.AsyncClient and await client.trigger(...). The package is on PyPI; its calls were checked on 2026-11-18.
Step 2: rename the auth and webhook calls
from django.http import HttpResponseForbidden, JsonResponse
from django.views.decorators.http import require_POST
from .realtime import client
def pusher_auth(request):
channel = request.POST["channel_name"]
socket_id = request.POST["socket_id"]
if not request.user.is_authenticated:
return HttpResponseForbidden()
if channel.startswith("presence-"):
user = {"user_id": str(request.user.pk), "user_info": {"name": request.user.get_full_name()}}
return JsonResponse(client.authenticate_channel(channel, socket_id, user))
return JsonResponse(client.authenticate_channel(channel, socket_id))For webhooks, pass the raw body and the two headers to client.verify_webhook(key, signature, request.body). It returns the parsed body, or raises hibira.InvalidWebhook when the signature is wrong.
Step 3: point pusher-js at the new host
const pusher = new Pusher('{{ HIBIRA_APP_KEY }}', {
cluster: 'mt1',
wsHost: 'ws.hibira.io',
wsPort: 443,
wssPort: 443,
forceTLS: true,
enabledTransports: ['ws', 'wss'],
channelAuthorization: {
endpoint: '/pusher/auth/',
transport: 'ajax',
headers: { 'X-CSRFToken': '{{ csrf_token }}' },
},
});To switch without a gap, keep the old pusher.Pusher client for a day or two and publish each event through both, then remove it when Pusher shows no more connections.
Or skip the JavaScript
If your pages render HTML on the server, the django-hibira package makes a list live with one decorator: saved rows are rendered and pushed to every open page, with no Django Channels, ASGI server or Redis. The Python guide covers the hibira package on its own, including FastAPI and Flask.
Questions
Why can't I keep the official pusher package?
It checks that the app ID is a number and refuses anything else. Hibira's app IDs are not numeric, so the package raises an error before it sends anything. The hibira package speaks the same HTTP API without that check.
Do my channel names and events change?
No. Channel names, event names, payloads and presence member data stay the same, and pusher-js in the browser keeps working with a new host.
Does it work with Celery tasks?
Yes. Publishing is an HTTP request, so it works from views, signals, management commands and Celery tasks alike. With django-hibira, broadcasts wait for the transaction to commit.
Is the auth view still protected by CSRF?
Yes, if you keep Django's CSRF middleware. Send the token in channelAuthorization.headers, as above, or exempt only that view if it checks the session itself.
Product names are trademarks of their owners.