Official package · Game engines
Phaser multiplayer rooms over WebSockets
A complete Phaser 4 example: a room list, seats for four, a host, ready flags, chat with typing indicators and a reaction game, all drawn in a canvas. Phaser, browser and Godot players can play in the same room.
@hibira-io/lobbyLive demo ↗GitHub ↗
- The Lobby package runs in Phaser as it is: it only needs pusher-js.
- Every tap is a client event on the room channel; no game server to run.
- Names and chat use real inputs over the canvas, so Chinese, Japanese and Korean input methods work.
Sign in to see these snippets with your own cluster host. Sign in
Install
git clone https://github.com/hibira-io/examples cd examples/phaser-lobby npm install && npm run devUse it
import Pusher from 'pusher-js'; import { Room } from '@hibira-io/lobby'; const pusher = new Pusher(import.meta.env.VITE_HIBIRA_APP_KEY, { cluster: 'hkg', wsHost: 'ws.hibira.io', channelAuthorization: { endpoint: '/api/hibira/auth' }, }); const room = Room.join(pusher, 'presence-room-42', { capacity: 4 }); room.on('start', ({ data }) => this.scene.start('Game', data));
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 →