Official package · Frameworks
Live updates in SolidJS with signals
Subscribe to Hibira channels from SolidJS with pusher-js and a small primitive that turns an event into a signal, cleaned up with its owner. SolidStart signs private channels on the server.
Fastest way: one prompt with the Hibira plugin
Install the plugin in your AI coding agent and paste the prompt. The agent signs you in, creates a free app if you need one, writes the code and sends a test event. GitHub ↗
Install the plugin
claude plugin marketplace add hibira-io/agent-plugin claude plugin install hibira@hibiraPaste this prompt
Add Hibira SolidJS (pusher-js) to this project. Follow https://hibira.io/guides/solidjs, adapted to how this project is already set up. If I have no Hibira app yet, create a Free one that allows http://localhost so I can test right away. Keep the app key and secret in environment variables, add placeholders to .env.example, and never commit real values or send the secret to a browser. When you are done, send a test event, show me it arriving, and list the files you changed.
Prefer to do it by hand? These are the steps below:
- createEvent returns a signal that holds the latest event and unsubscribes when the component unmounts.
- A SolidStart API route signs private and presence channels with the pusher npm package.
Sign in to see these snippets with your own cluster host. Sign in
Install
npm install pusher-js pusherUse it
import Pusher from 'pusher-js'; import { createSignal, onCleanup } from 'solid-js'; const pusher = new Pusher(import.meta.env.VITE_HIBIRA_APP_KEY, { cluster: 'hkg', wsHost: 'ws.hibira.io', channelAuthorization: { endpoint: '/api/hibira/auth', transport: 'ajax' }, }); export function createEvent<T>(channelName: string, event: string) { const [value, setValue] = createSignal<T>(); const channel = pusher.subscribe(channelName); const handler = (data: T) => setValue(() => data); channel.bind(event, handler); onCleanup(() => channel.unbind(event, handler)); return value; } // const order = createEvent<{ id: number }>('orders', 'order.shipped');Sign channel subscriptions
// src/routes/api/hibira/auth.ts (SolidStart) import Pusher from 'pusher'; const pusher = new Pusher({ appId: process.env.HIBIRA_APP_ID!, key: process.env.HIBIRA_APP_KEY!, secret: process.env.HIBIRA_APP_SECRET!, host: 'ws.hibira.io', port: '443', useTLS: true, }); export async function POST({ request }: { request: Request }) { const form = await request.formData(); // check the signed-in user may join this channel first return Response.json(pusher.authorizeChannel(String(form.get('socket_id')), String(form.get('channel_name')))); }
Before you start
- On the Free plan, list every origin your pages load from in the app’s allowed origins (http://localhost:3000 while developing, then your domain). "*" needs a paid plan.
- The app secret is shown only once, when you create the app or rotate its secret. Keep it on your server, never in a browser or game build.
Use the app key from your dashboard; the secret stays on your server. Channels, events and authorization endpoints work exactly as they do with Pusher. Create your free account →