Server library
Realtime Python with WebSockets Publish from Django, Flask, FastAPI or any Python service.
Sign in to see these snippets with your own cluster host. Sign in
Using an AI coding agent? Copy the agent prompt ↓
Install Publish an event import pusher
client = pusher.Pusher(
app_id="YOUR_APP_ID" ,
key="YOUR_APP_KEY" ,
secret="YOUR_APP_SECRET" ,
host="ws.hibira.io" ,
port=443 ,
ssl=True ,
)
client.trigger("orders" , "order-shipped" , {"id" : 1024 })Agent prompt Paste this into Claude Code, Cursor, GitHub Copilot or another AI coding agent, and it will wire Hibira into your Python project with the settings above.
Integrate Hibira realtime messaging into this Python project. Hibira is a hosted WebSocket service that speaks the Pusher Channels protocol, so it works with the standard Pusher libraries (here: pusher, https://github.com/pusher/pusher-http-python) pointed at Hibira instead of pusher.com.
Connection details:
- Host: ws.hibira.io
- Port: 443
- TLS: yes (https)
- App ID: YOUR_APP_ID
- App key: YOUR_APP_KEY
- App secret: YOUR_APP_SECRET (server-side only)
What to do:
1. Look at the project first (framework version, package manager, config and env conventions, where similar integrations live) and follow what it already does.
2. Create one shared client (for example in settings, an app factory or a small realtime module) built from environment variables.
3. Publish from views, tasks or services through that client; in async frameworks like FastAPI, run trigger() in a thread pool so it doesn't block the event loop.
4. If the front end subscribes to private or presence channels, add an auth view that checks the user and returns client.authenticate(channel=..., socket_id=...).
5. Read the credentials and host from environment variables or the project's config, and add placeholder entries to .env.example (or its equivalent). Never commit real values, and never send the app secret to a browser or mobile app.
6. Always pass the host, port and TLS setting above. The library defaults to pusher.com; where it requires a cluster, use "ap" (the host decides where it connects).
7. If YOUR_APP_KEY or YOUR_APP_SECRET above is still a placeholder, keep it as an env placeholder and tell me where to fill it in rather than inventing a value.
8. When you are done, list the files you changed and tell me how to check it works, for example by publishing a test event and watching it arrive.
Reference setup from the Hibira Python guide (adapt it to the project's structure):
Install:
```shell
pip install pusher
```
Publish an event:
```python
import pusher
client = pusher.Pusher(
app_id="YOUR_APP_ID",
key="YOUR_APP_KEY",
secret="YOUR_APP_SECRET",
host="ws.hibira.io",
port=443,
ssl=True,
)
client.trigger("orders", "order-shipped", {"id": 1024})
```
Replace YOUR_APP_KEY and the other placeholders with the values from your dashboard, or let the agent leave them as environment variables for you to fill in.
Or connect the Hibira MCP server, and your agent can create the app and fill in its credentials itself. Connect your AI coding agent →
Use the app key and secret from your dashboard. Channels, events and authorization endpoints work exactly as they do with Pusher. Library reference ↗