Skip to main content
Version: v1

IServiceAudienceEvents Interface

Events that trigger when the roster of members in the Fluid session change. Only changes that would be reflected in the returned map of IServiceAudience's getMembers() method will emit events.

Signature

export interface IServiceAudienceEvents<M extends IMember> extends IEvent

Extends: IEvent

Type Parameters

Parameter Constraint Description
M IMember A service-specific member type.

Remarks

The following is the list of events emitted.

### "membersChanged"

The "membersChanged" event is emitted when a member is either added or removed.

#### Listener signature

() => void;

### "memberAdded"

The "memberAdded" event is emitted when a member joins the audience.

#### Listener signature

(clientId: string, member: M) => void;
  • clientId - A unique identifier for the client

  • member - The service-specific member object for the client

### "memberRemoved"

The "memberRemoved" event is emitted when a member leaves the audience.

#### Listener signature

(clientId: string, member: M) => void;
  • clientId - A unique identifier for the client

  • member - The service-specific member object for the client

Call Signatures

CallSignature Description
(event: "membersChanged", listener: () => void): void
(event: "memberAdded" | "memberRemoved", listener: (clientId: string, member: M) => void): void

Call Signature Details

(event: "membersChanged", listener: () => void): void

Signature

(event: "membersChanged", listener: () => void): void;

(event: "memberAdded" | "memberRemoved", listener: (clientId: string, member: M) => void): void

Signature

(event: "memberAdded" | "memberRemoved", listener: (clientId: string, member: M) => void): void;