ServiceAudience Class
Base class for providing audience information for sessions interacting with FluidContainer This can be extended by different service-specific client packages to additional parameters to the user and client details returned in IMember
Signature
export declare abstract class ServiceAudience<M extends IMember = IMember> extends TypedEventEmitter<IServiceAudienceEvents<M>> implements IServiceAudience<M>
Extends: TypedEventEmitter<IServiceAudienceEvents
Implements: IServiceAudience
Type Parameters
| Parameter | Constraint | Default | Description |
|---|---|---|---|
| M | IMember | IMember | A service-specific member type. |
Constructors
| Constructor | Description |
|---|---|
| (constructor)(container) | Constructs a new instance of the ServiceAudience class |
Properties
| Property | Type | Description |
|---|---|---|
| audience | IAudience | Audience object which includes all the existing members of the container. |
| container | IContainer | Fluid Container to read the audience from. |
| lastMembers | Map<string, M> | Retain the most recent member list. This is so we have more information about a member leaving the audience in the removeMember event. It allows us to match the behavior of the addMember event where it only fires on a change to the members this class exposes (and would actually produce a change in what getMembers returns). It also allows us to provide the client details in the event which makes it easier to find that client connection in a map keyed on the userId and not clientId. This map will always be up-to-date in a removeMember event because it is set once at construction and in every addMember event. It is mapped clientId to M to be better work with what the IAudience event provides |
Methods
| Method | Return Type | Description |
|---|---|---|
| createServiceMember(audienceMember) | M | Provides ability for inheriting class to modify/extend the audience object. |
| getMembers() | Map<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() | M | undefined | Returns the current active user on this client once they are connected. Otherwise, returns undefined. |
| shouldIncludeAsMember(member) | boolean | Provides ability for the inheriting class to include/omit specific members. An example use case is omitting the summarizer client. |
Constructor Details
(constructor)
Constructs a new instance of the ServiceAudience class
Signature
constructor(
container: IContainer);