Presence (Broadcaster Discovery)
Presence lets your app discover which broadcasters are currently sharing with you, plus their latest telemetry snapshot.
Prerequisites
- Your app's
clientId(from DevHub) - A target
gameId(for example,msfsorxplane)
Create a Presence Listener
javascript
const presence = await ggClient.createPresenceListener({
clientId: 'your-client-id',
gameId: 'msfs'
});This returns a PresenceListener that stays up to date as broadcasters come online or go offline.
Listen for Updates
javascript
presence.on('update', (snapshot) => {
console.log('Broadcaster update', snapshot.userId, snapshot.data);
});
presence.on('remove', ({ userId }) => {
console.log('Broadcaster offline', userId);
});Snapshot Shape
Each update includes:
userIdusernamedisplayNamegameIddata(normalized telemetry)raw(original telemetry payload)updatedAt(epoch ms)
Current Broadcasters
If you need a snapshot of who is currently online:
javascript
const broadcasters = presence.getBroadcasters();Notes
- Presence connections do not require authentication.
- Only broadcasters who opted into sharing with your app will appear.