Multiplayer Gaming
Build multiplayer lobbies, turn-based games, realtime leaderboards, and live game state synchronization. Presence channels track who is in each game room, and client events enable direct player-to-player communication.
Implementation
// Join a game lobby with presence (identity comes from your auth endpoint's channel_data)
const lobby = client.connect().subscribe('presence-game-xyz')
// Get list of players once the subscription succeeds
lobby.bind('realtime:subscription_succeeded', () => {
renderPlayers(lobby.getMembers())
})
// Send player move (client event, instant delivery)
lobby.trigger('client-move', {
action: 'attack',
target: { x: 12, y: 8 }
})
// React to other players' moves
lobby.bind('client-move', (data) => animateMove(data))Why Apinator for multiplayer gaming
Other use cases
Live Chat & Messaging
Build realtime chat experiences with channels, typing indicators, and presence.
Live Notifications & Activity Feeds
Deliver instant notifications and live activity feeds to your users.
Collaborative Editing
Build Google Docs-style collaboration with live cursors and realtime sync.
From the blog
How to Build a Multiplayer Game with WebSockets
Build a real-time multiplayer game using WebSockets — from game state synchronization to player presence and input broadcasting, with a working example.
How the WebSocket Handshake Works
The WebSocket connection starts as HTTP and upgrades to a persistent socket. Here's exactly what happens during the handshake — headers, keys, and all.
Presence Channels Explained
Presence channels let you track who's online in real time — showing typing indicators, viewer counts, and live cursors without building your own member tracking.
Ready to build multiplayer gaming?
Get started in minutes. Completely free, no credit card required.