Skip to main content

IServiceAudience Interface

Base interface to be implemented to fetch each service's audience.

Signature​

export interface IServiceAudience<M extends IMember> extends IEventProvider<IServiceAudienceEvents<M>>

Extends: IEventProvider<IServiceAudienceEvents<M>>

Type Parameters​

ParameterConstraintDescription
MIMemberA service-specific IMember type.

Remarks​

The type parameter M allows consumers to further extend the client object with service-specific details about the connecting client, such as device information, environment, or a username.

Methods​

MethodReturn TypeDescription
getMembers()ReadonlyMap<string, M>Returns an map of all users currently in the Fluid session where key is the userId and the value is the member object. The implementation may choose to exclude certain connections from the returned map. E.g. ServiceAudience excludes non-interactive connections to represent only the roster of live users.
getMyself()Myself<M> | undefinedReturns the current active user on this client once they are connected. Otherwise, returns undefined.

Method Details​

getMembers​

Returns an map of all users currently in the Fluid session where key is the userId and the value is the member object. The implementation may choose to exclude certain connections from the returned map. E.g. ServiceAudience excludes non-interactive connections to represent only the roster of live users.

Signature​

getMembers(): ReadonlyMap<string, M>;

Returns​

Return type: ReadonlyMap<string, M>

getMyself​

Returns the current active user on this client once they are connected. Otherwise, returns undefined.

Signature​

getMyself(): Myself<M> | undefined;

Returns​

Return type: Myself<M> | undefined