Info
- Running apps, their events connection, stream control and LiveKit tokens. Paths below are under
/api/v2
- Service Hub does the control (presence, commands, displays). LiveKit carries only the media
- Presence and the events connection work in every app. Stream calls need the Streams service on for the app, otherwise
403 service_disabled. Without LiveKit set up on the hub, stream tokens answer 503 streaming_unavailable
- Callers: the player's Bearer token, a guest pass from the lobby (Lobby API) as Bearer token with
X-App-Key, or, for presence and the events connection only, the session host with its session secret in X-Session-Secret and X-App-Key
- Stream calls refuse the host, and server tokens get neither:
403 player_token_required
- A host secret or guest pass of a session that ended answers
404 session_not_found
- Each client sends
X-Instance-Id on these calls: a stable ID of this running client, up to 64 characters, that keeps one person's desktop and headset apart. A player's defaults to their sign-in
- Base URL, app key, tokens, errors, lists and rate limits: API
- Unity side:
PresenceService and PresenceClient in ServiceHub/Presence, StreamingManager in ServiceHub/Streaming
Events connection
GET /events - server-sent events (text/event-stream) while the app runs. Open it at start and keep it open. Same callers as presence, with X-Instance-Id and X-App-Device-Type (headset, desktop or mobile, shown to staff with who's online)
- First
hello with instance_id and participant
- Then a
command event for each command or hub event: seq, id, type, data and expires_at. Its id: line is the seq. When you reconnect, send the last one in Last-Event-ID to get what came after
replaced when a newer connection of the same client takes over: this one is done, don't reconnect it. signed_out when the player's sign-in ended: sign in again first
- A
: ping comment comes every 20 s. The hub closes the connection after 30 minutes or when the token runs out. Reconnect, with a fresh token
- While it's open and 60 s after, the app counts as running: online for friends and for staff. Opening it is enough for that. Report a presence only for a session, displays or sources
Presence
PUT /presence - report when the session or what the client shows or shares changes. Without the events connection also before expires_at
protocol (contract version, 1 by default), join_code of the session the app is in, device (headset, desktop or mobile)
sources - what this client shares: id (view:<participant>, present:<participant> or cam:<id>, also the LiveKit track name), label, has_audio, open (true: everyone in the session may watch, false: only the allowed participants)
watching - source IDs this client receives now, in a window or on a display. The hub tells the publishers
displays - screens in the app that show a source: id, name, place, allow (anyone, managers or nobody), current source and presenter (the participant who put it there). The host's displays are for everyone in its session
- The host's session comes from its secret and a guest's from its pass, so they need no
join_code
- Returns
identity (user ID, guest ID, or host-… for the host), participant (the LiveKit identity, also used in source IDs), the matched join_code (null outside a session or when the player isn't let in) and expires_at (60 s on, longer while the events connection is open)
POST /presence/commands/{id}/reply - result, optional data. Answers 204. 404 command_not_found when the command is unknown, expired or not this client's, presence_not_found when the client isn't running
Commands
- Commands come on the events connection. The hub sends only commands the app's
protocol knows, an app with the events connection open gets every type. Reply before the command's expires_at