Audience Class
Packages > @fluidframework/container-loader > Audience
Audience represents all clients connected to the op stream.
Signature:
export declare class Audience extends EventEmitter implements IAudience
Extends: EventEmitter
Implements: IAudience
Methods
Method | Modifiers | Description |
---|---|---|
addMember(clientId, details) | Adds a new client to the audience | |
clear() | Clears the audience | |
getMember(clientId) | Retrieves a specific member of the audience | |
getMembers() | Retrieves all the members in the audience | |
on(event, listener) | ||
on(event, listener) | ||
removeMember(clientId) | Removes a client from the audience |
Methods
addMember
Adds a new client to the audience
Signature:
addMember(clientId: string, details: IClient): void;
Parameters
Parameter | Type | Description |
---|---|---|
clientId | string | |
details | IClient |
Returns:
void
clear
Clears the audience
Signature:
clear(): void;
Returns:
void
getMember
Retrieves a specific member of the audience
Signature:
getMember(clientId: string): IClient | undefined;
Parameters
Parameter | Type | Description |
---|---|---|
clientId | string |
Returns:
IClient | undefined
getMembers
Retrieves all the members in the audience
Signature:
getMembers(): Map<string, IClient>;
Returns:
Map<string, IClient>
on
Signature:
on(event: "addMember", listener: (clientId: string, details: IClient) => void): this;
Parameters
Parameter | Type | Description |
---|---|---|
event | "addMember" | |
listener | (clientId: string, details: IClient) => void |
Returns:
this
on
Signature:
on(event: "removeMember", listener: (clientId: string) => void): this;
Parameters
Parameter | Type | Description |
---|---|---|
event | "removeMember" | |
listener | (clientId: string) => void |
Returns:
this
removeMember
Removes a client from the audience
Signature:
removeMember(clientId: string): void;
Parameters
Parameter | Type | Description |
---|---|---|
clientId | string |
Returns:
void