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

MethodReturn TypeDescription
getMember(clientId)IClient | undefinedGet 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

ParameterTypeDescription
clientIdstring

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

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

Returns

Return type: this