Presence channel

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

example.js
// 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

Presence channels for game lobbies — see who is in the room
Client events for player moves with no server roundtrip
Low-latency delivery for responsive gameplay feel
Presence join/leave events to update the lobby on every client
Auto-reconnect to survive brief network interruptions
Scale from 2-player games to massive lobbies

Ready to build multiplayer gaming?

Get started in minutes. Completely free, no credit card required.