Skip to main content
zerotal

Documentation


Documentation / @zerotal/flow / index / PresenceMember

Interface: PresenceMember

Defined in: flow/src/presence.ts:37

One member of a broadcast presence channel — the shape used to populate a @presence prop (the live "who's here" list).

Each member carries a required id plus whatever additional member data the broadcasting layer attached when the client joined (name, avatar, etc.).

Remarks

@presence props are server-controlled: flow refills them with the current member list before render and on each join/leave, so they are read-only on the client. Presence requires the optional @zerotal/broadcasting peer; without it, populating presence is a no-op and props keep their default.

Example

class RoomHeader extends Component {
  @locked roomId = "";
  @presence((self) => `room.${self.roomId}`)
  members: PresenceMember[] = [];

  async render() {
    return <div>{this.members.length} online</div>;
  }
}

Indexable

[key: string]: unknown

Arbitrary extra member data supplied when the client joined the channel.

Properties

id

id: string | number

Defined in: flow/src/presence.ts:39

Stable identifier for the member, as reported by broadcasting.