Opens a Server-Sent Events (SSE) stream for real-time lobby updates. The caller is identified by x-player-id.
Event types:
| Event | Description | Frequency |
|---|---|---|
connected | Initial event with full lobby state | Once on connect |
lobby_updated | Lobby state changed (player joined/left, settings changed, game started, etc.) | On every change |
lobby_deleted | Lobby was deleted (all players left or timeout) | Once, then stream closes |
queue_stats | Live matchmaking queue statistics | Every 10s while in_queue |
ping | Keep-alive heartbeat | Every 30s |
Usage (JavaScript):
const es = new EventSource('/api/v3/lobbies/casual/me/events', {
headers: { 'api-key': 'pf_...', 'x-player-id': 'player123' }
});
es.addEventListener('lobby_updated', (e) => {
const lobby = JSON.parse(e.data);
updateUI(lobby);
});
Connection lifecycle: The stream stays open until the client disconnects, the lobby is deleted, or the player is kicked. Reconnect automatically on disconnect.