Official package · Realtime building blocks

Game rooms and lobbies over WebSockets

Rooms on presence channels: seats in join order, a host who hands over when they leave, ready flags, settings, kick, start and room chat. The server half signs seats and lists open rooms.

  • Works in the browser, React Native and game engines that run JavaScript.
  • authorizeRoom() keeps rooms to their capacity; listRooms() returns the open ones.
  • Unity and Godot rooms speak the same events, so players on every engine meet in one room.

Sign in to see these snippets with your own cluster host. Sign in

  1. Install

    npm install @hibira-io/lobby pusher-js
  2. Use it

    import { Room } from '@hibira-io/lobby';
    
    const pusher = new Pusher('YOUR_APP_KEY', {
      cluster: 'hkg',
      wsHost: 'ws.hibira.io',
      channelAuthorization: { endpoint: '/rooms/auth' },
    });
    const room = Room.join(pusher, 'presence-room-42', { capacity: 4 });
    room.on('members', ({ players }) => render(players));
    room.setReady(true);

Before you start

  • Turn on Allow client events in the app’s settings, so players can send each other moves and taps.
  • Private and presence channels need an auth endpoint on your backend that signs subscriptions with the app secret, as with pusher-js.

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 →