Skip to main content
Version: v1

IAudience Interface

Audience represents all clients connected to the op stream, both read-only and read/write.

Signature

export interface IAudience extends EventEmitter

Extends: EventEmitter

Methods

Method Return Type Description
getMember(clientId) IClient | undefined Get details about the connected client with the specified clientId, or undefined if the specified client isn't connected
getMembers() Map<string, IClient> List all clients connected to the op stream, keyed off their clientId
on(event, listener) this

Method Details

getMember

Get details about the connected client with the specified clientId, or undefined if the specified client isn't connected

Signature

getMember(clientId: string): IClient | undefined;

Parameters

Parameter Type Description
clientId string

Returns

Return type: IClient | undefined

getMembers

List all clients connected to the op stream, keyed off their clientId

Signature

getMembers(): Map<string, IClient>;

Returns

Return type: Map<string, IClient>

on

Signature

on(event: "addMember" | "removeMember", listener: (clientId: string, client: IClient) => void): this;

Parameters

Parameter Type Description
event "addMember" | "removeMember"
listener (clientId: string, client: IClient) => void

Returns

Return type: this