Replay: presence property
Available since
@irtio/client 5.0BrowsersNodeThe presence read-only property of the Replay interface lists who was in the room at the tick shown, as RoomClient.presence does on a live client.
Value
A PresenceList.
Description
Its events fire during playback as a live client’s do: join when a player’s presence starts, change when their name, status or connection changes, and leave when it ends. A seek() makes every player shown leave and those at the new tick join. presence.me is undefined, since a replay has no local player, and setStatus() throws an Error.
Examples
Listing the players of a replay
A replay viewer shows who was in the room at the tick shown, and who had dropped.
// replay-roster.ts
import type { Replay } from "@irtio/client/replay";
export function roster(replay: Replay): string[] {
return [...replay.presence].map((p) => (p.connected ? p.name : `${p.name} (disconnected)`));
}
See also
Runtime availability
| Browsers | Node | |
|---|---|---|
presence | 5.0 | 5.0 |