Skip to content

LocalParticipant

Defined in: client-sdk-js/src/participant/LocalParticipant.ts:69

A typed wrapper over Node’s EventEmitter.

Extends EventEmitter with declare overrides so that emit, on, off, etc. are type-safe without introducing circular-reference issues that arise when using typed-emitter directly in extends clauses whose event maps reference the class itself.

Runtime behaviour is 100% EventEmitter; this class adds zero runtime code.

new LocalParticipant(
sid,
identity,
name?,
metadata?
): LocalParticipant;

Defined in: client-sdk-js/src/participant/Participant.ts:178

string

string

string

string

LocalParticipant

Participant.constructor

addListener: <E>(event, listener) => this;

Defined in: client-sdk-js/src/utils/typedEmitter.ts:37

E extends string | number

E

E extends keyof ParticipantEvents<LocalTrackPublication> ? ParticipantEvents<LocalTrackPublication>[E] : (…args) => void

this

Participant.addListener


attributes: Record<string, string> = {};

Defined in: client-sdk-js/src/participant/Participant.ts:157

Participant.attributes


audioLevel: number = 0;

Defined in: client-sdk-js/src/participant/Participant.ts:156

Participant.audioLevel


audioTrackPublications: Map<string, LocalTrackPublication>;

Defined in: client-sdk-js/src/participant/Participant.ts:162

Participant.audioTrackPublications


emit: <E>(event, ...args) => boolean;

Defined in: client-sdk-js/src/utils/typedEmitter.ts:17

E extends ParticipantEvent

E

…Parameters<ParticipantEvents<LocalTrackPublication>[E]>

boolean

Participant.emit


groupId?: string;

Defined in: client-sdk-js/src/participant/Participant.ts:160

The group (breakout room) this participant is currently in. undefined = main room.

Participant.groupId


identity: string;

Defined in: client-sdk-js/src/participant/Participant.ts:151

Participant.identity


isSpeaking: boolean = false;

Defined in: client-sdk-js/src/participant/Participant.ts:155

Participant.isSpeaking


joinedAt?: Date;

Defined in: client-sdk-js/src/participant/Participant.ts:165

Participant.joinedAt


lastSpokeAt?: Date;

Defined in: client-sdk-js/src/participant/Participant.ts:164

Participant.lastSpokeAt


listenerCount: (event) => number;

Defined in: client-sdk-js/src/utils/typedEmitter.ts:57

string | number

number

Participant.listenerCount


listeners: <E>(event) => E extends keyof ParticipantEvents<LocalTrackPublication> ? ParticipantEvents<LocalTrackPublication>[E][] : ((...args) => void)[];

Defined in: client-sdk-js/src/utils/typedEmitter.ts:49

E extends string | number

E

E extends keyof ParticipantEvents<LocalTrackPublication> ? ParticipantEvents<LocalTrackPublication>[E][] : ((…args) => void)[]

Participant.listeners


metadata?: string;

Defined in: client-sdk-js/src/participant/Participant.ts:153

Participant.metadata


name?: string;

Defined in: client-sdk-js/src/participant/Participant.ts:152

Participant.name


off: <E>(event, listener) => this;

Defined in: client-sdk-js/src/utils/typedEmitter.ts:32

E extends string | number

E

E extends keyof ParticipantEvents<LocalTrackPublication> ? ParticipantEvents<LocalTrackPublication>[E] : (…args) => void

this

Participant.off


on: <E>(event, listener) => this;

Defined in: client-sdk-js/src/utils/typedEmitter.ts:22

E extends string | number

E

E extends keyof ParticipantEvents<LocalTrackPublication> ? ParticipantEvents<LocalTrackPublication>[E] : (…args) => void

this

Participant.on


once: <E>(event, listener) => this;

Defined in: client-sdk-js/src/utils/typedEmitter.ts:27

E extends string | number

E

E extends keyof ParticipantEvents<LocalTrackPublication> ? ParticipantEvents<LocalTrackPublication>[E] : (…args) => void

this

Participant.once


permissions?: ParticipantPermission;

Defined in: client-sdk-js/src/participant/Participant.ts:158

Participant.permissions


rawListeners: <E>(event) => E extends keyof ParticipantEvents<LocalTrackPublication> ? ParticipantEvents<LocalTrackPublication>[E][] : ((...args) => void)[];

Defined in: client-sdk-js/src/utils/typedEmitter.ts:53

E extends string | number

E

E extends keyof ParticipantEvents<LocalTrackPublication> ? ParticipantEvents<LocalTrackPublication>[E][] : ((…args) => void)[]

Participant.rawListeners


removeAllListeners: (event?) => this;

Defined in: client-sdk-js/src/utils/typedEmitter.ts:47

string | number

this

Participant.removeAllListeners


removeListener: <E>(event, listener) => this;

Defined in: client-sdk-js/src/utils/typedEmitter.ts:42

E extends string | number

E

E extends keyof ParticipantEvents<LocalTrackPublication> ? ParticipantEvents<LocalTrackPublication>[E] : (…args) => void

this

Participant.removeListener


roomOptions?: RoomOptions;

Defined in: client-sdk-js/src/participant/LocalParticipant.ts:86

Room-level options passed in from the Room instance.


sid: string;

Defined in: client-sdk-js/src/participant/Participant.ts:150

Participant.sid


state: ParticipantState;

Defined in: client-sdk-js/src/participant/Participant.ts:154

Participant.state


trackPublications: Map<string, LocalTrackPublication>;

Defined in: client-sdk-js/src/participant/Participant.ts:161

Participant.trackPublications


videoTrackPublications: Map<string, LocalTrackPublication>;

Defined in: client-sdk-js/src/participant/Participant.ts:163

Participant.videoTrackPublications


static defaultMaxListeners: number;

Defined in: client-sdk-js/node_modules/.pnpm/@types+events@3.0.3/node_modules/@types/events/index.d.ts:5

Participant.defaultMaxListeners

get connectionQuality(): ConnectionQuality;

Defined in: client-sdk-js/src/participant/Participant.ts:217

Current connection quality for this participant.

ConnectionQuality

Participant.connectionQuality


get isActive(): boolean;

Defined in: client-sdk-js/src/participant/Participant.ts:200

Whether the participant is in an active (joined) state.

boolean

Participant.isActive


get isAgent(): boolean;

Defined in: client-sdk-js/src/participant/Participant.ts:195

Whether this participant is an AI agent.

boolean

Participant.isAgent


get isCameraEnabled(): boolean;

Defined in: client-sdk-js/src/participant/Participant.ts:251

Whether the participant has an enabled camera track.

boolean

Participant.isCameraEnabled


get isLocal(): boolean;

Defined in: client-sdk-js/src/participant/LocalParticipant.ts:88

boolean

Participant.isLocal


get isMicrophoneEnabled(): boolean;

Defined in: client-sdk-js/src/participant/Participant.ts:256

Whether the participant has an enabled microphone track.

boolean

Participant.isMicrophoneEnabled


get isScreenShareEnabled(): boolean;

Defined in: client-sdk-js/src/participant/Participant.ts:261

Whether the participant is sharing their screen.

boolean

Participant.isScreenShareEnabled


get kind(): ParticipantKind;

Defined in: client-sdk-js/src/participant/Participant.ts:190

The kind of participant (Standard, Agent, etc.).

ParticipantKind

Participant.kind


get lastCameraError(): Error | undefined;

Defined in: client-sdk-js/src/participant/LocalParticipant.ts:125

Last error encountered while creating a camera track.

Error | undefined


get lastMicrophoneError(): Error | undefined;

Defined in: client-sdk-js/src/participant/LocalParticipant.ts:130

Last error encountered while creating a microphone track.

Error | undefined

createScreenTracks(options?): Promise<LocalTrack[]>;

Defined in: client-sdk-js/src/participant/LocalParticipant.ts:1104

Create screen share tracks without publishing.

ScreenShareCaptureOptions

Promise<LocalTrack[]>


createTracks(options?): Promise<LocalTrack[]>;

Defined in: client-sdk-js/src/participant/LocalParticipant.ts:1079

Create local tracks without publishing. Useful for creating preview tracks.

boolean | AudioCaptureOptions

boolean | VideoCaptureOptions

Promise<LocalTrack[]>


deleteMessage(id): Promise<void>;

Defined in: client-sdk-js/src/participant/LocalParticipant.ts:853

Delete a single message by ID.

string

Promise<void>


deleteRoomState(key): Promise<void>;

Defined in: client-sdk-js/src/participant/LocalParticipant.ts:869

Delete a key from the room’s shared state.

string

Promise<void>


editChatMessage(editText, originalMessage): Promise<Message>;

Defined in: client-sdk-js/src/participant/LocalParticipant.ts:879

string

Message

Promise<Message>

Use editMessage instead.


editMessage(editText, originalMessage): Promise<Message>;

Defined in: client-sdk-js/src/participant/LocalParticipant.ts:839

Edit a previously sent message.

string

Message

Promise<Message>


enableCameraAndMicrophone(captureOptions?, publishOptions?): Promise<void>;

Defined in: client-sdk-js/src/participant/LocalParticipant.ts:224

Enable both camera and microphone simultaneously. Uses a single getUserMedia call so the user only grants permission once.

AudioCaptureOptions

VideoCaptureOptions

TrackPublishOptions

Promise<void>


eventNames(): (string | number)[];

Defined in: client-sdk-js/node_modules/.pnpm/@types+events@3.0.3/node_modules/@types/events/index.d.ts:7

(string | number)[]

Participant.eventNames


getMaxListeners(): number;

Defined in: client-sdk-js/node_modules/.pnpm/@types+events@3.0.3/node_modules/@types/events/index.d.ts:9

number

Participant.getMaxListeners


getTrackPublication(source): LocalTrackPublication | undefined;

Defined in: client-sdk-js/src/participant/Participant.ts:344

TrackSource

LocalTrackPublication | undefined

Participant.getTrackPublication


getTrackPublicationByName(name): LocalTrackPublication | undefined;

Defined in: client-sdk-js/src/participant/Participant.ts:359

Find a track publication by its name.

string

LocalTrackPublication | undefined

Participant.getTrackPublicationByName


getTrackPublications(): LocalTrackPublication[];

Defined in: client-sdk-js/src/participant/Participant.ts:268

Returns all track publications as an array.

LocalTrackPublication[]

Participant.getTrackPublications


joinGroup(groupId): Promise<ParticipantInfo[]>;

Defined in: client-sdk-js/src/participant/LocalParticipant.ts:764

Join a group (breakout room). The server will rewire subscriptions so that only participants in the same group exchange media. Permissions may change to the group-level permissions.

string

Promise<ParticipantInfo[]>

The list of other participants already in the group.


leaveGroup(): Promise<void>;

Defined in: client-sdk-js/src/participant/LocalParticipant.ts:774

Leave the current group and return to the main room. Permissions revert to room-level defaults.

Promise<void>


performRpc(params): Promise<string>;

Defined in: client-sdk-js/src/participant/LocalParticipant.ts:928

Perform an RPC call to a specific remote participant. The remote participant must have registered a handler for the method via room.registerRpcMethod.

PerformRpcParams

Promise<string>

The response payload string.


prependListener(type, listener): this;

Defined in: client-sdk-js/node_modules/.pnpm/@types+events@3.0.3/node_modules/@types/events/index.d.ts:14

string | number

Listener

this

Participant.prependListener


prependOnceListener(type, listener): this;

Defined in: client-sdk-js/node_modules/.pnpm/@types+events@3.0.3/node_modules/@types/events/index.d.ts:15

string | number

Listener

this

Participant.prependOnceListener


publishData(data, options?): Promise<void>;

Defined in: client-sdk-js/src/participant/LocalParticipant.ts:643

Uint8Array

DataPublishOptions

Promise<void>


publishTrack(track, options?): Promise<LocalTrackPublication>;

Defined in: client-sdk-js/src/participant/LocalParticipant.ts:264

MediaStreamTrack | LocalTrack

TrackPublishOptions

Promise<LocalTrackPublication>


republishAllTracks(options?, restartTracks?): Promise<void>;

Defined in: client-sdk-js/src/participant/LocalParticipant.ts:1116

Re-publish all currently published tracks. Useful after a full reconnect or when changing publish options globally.

The transportclose handler only clears producers, not trackPublications, so the publications are still available here even after the old transport has been closed.

TrackPublishOptions

boolean = true

Promise<void>


sendChatMessage(text, options?): Promise<Message>;

Defined in: client-sdk-js/src/participant/LocalParticipant.ts:874

string

SendTextOptions

Promise<Message>

Use sendMessage instead.


sendFile(file, options?): Promise<{
id: string;
}>;

Defined in: client-sdk-js/src/participant/LocalParticipant.ts:905

Send a file to participants via data stream.

File

SendFileOptions

Promise<{ id: string; }>


sendMessage(text, options?): Promise<Message>;

Defined in: client-sdk-js/src/participant/LocalParticipant.ts:815

Send a message to all participants in the room.

string

The message text / payload.

SendTextOptions & object

Optional settings such as type, transient, topic, etc.

Promise<Message>


sendText(text, options?): Promise<{
id: string;
}>;

Defined in: client-sdk-js/src/participant/LocalParticipant.ts:888

Send a complete text message to participants via data stream.

string

SendTextOptions

Promise<{ id: string; }>


setAttributes(attributes): Promise<void>;

Defined in: client-sdk-js/src/participant/LocalParticipant.ts:751

Set or update participant attributes. It will make updates only to keys that are present in attributes, and will not override others. Note: this requires canUpdateMetadata permission.

Record<string, string>

Promise<void>


setCameraEnabled(
enabled,
captureOptions?,
publishOptions?
): Promise<LocalTrackPublication | undefined>;

Defined in: client-sdk-js/src/participant/LocalParticipant.ts:134

boolean

VideoCaptureOptions

TrackPublishOptions

Promise<LocalTrackPublication | undefined>


setMaxListeners(n): this;

Defined in: client-sdk-js/node_modules/.pnpm/@types+events@3.0.3/node_modules/@types/events/index.d.ts:8

number

this

Participant.setMaxListeners


setMetadata(metadata): Promise<void>;

Defined in: client-sdk-js/src/participant/LocalParticipant.ts:732

Sets and updates the metadata of the local participant. Note: this requires canUpdateMetadata permission.

string

Promise<void>


setMicrophoneEnabled(
enabled,
captureOptions?,
publishOptions?
): Promise<LocalTrackPublication | undefined>;

Defined in: client-sdk-js/src/participant/LocalParticipant.ts:163

boolean

AudioCaptureOptions

TrackPublishOptions

Promise<LocalTrackPublication | undefined>


setName(name): Promise<void>;

Defined in: client-sdk-js/src/participant/LocalParticipant.ts:741

Sets and updates the name of the local participant. Note: this requires canUpdateMetadata permission.

string

Promise<void>


setScreenShareEnabled(
enabled,
captureOptions?,
publishOptions?
): Promise<LocalTrackPublication | undefined>;

Defined in: client-sdk-js/src/participant/LocalParticipant.ts:192

boolean

ScreenShareCaptureOptions

TrackPublishOptions

Promise<LocalTrackPublication | undefined>


setTrackSubscriptionPermissions(allParticipantsAllowed, participantTrackPermissions?): void;

Defined in: client-sdk-js/src/participant/LocalParticipant.ts:790

Control who can subscribe to LocalParticipant’s published tracks.

By default, all participants can subscribe. This allows fine-grained control over who is able to subscribe at a participant and track level.

boolean

Allows all participants to subscribe all tracks. Takes precedence over participantTrackPermissions if set to true.

ParticipantTrackPermission[] = []

Full list of individual permissions per participant/track. Any omitted participants will not receive any permissions.

void


streamBytes(options?): Promise<ByteStreamWriter>;

Defined in: client-sdk-js/src/participant/LocalParticipant.ts:914

Open an incremental byte stream to participants. Returns a writer that can be used to send byte chunks.

StreamBytesOptions

Promise<ByteStreamWriter>


streamText(options?): Promise<TextStreamWriter>;

Defined in: client-sdk-js/src/participant/LocalParticipant.ts:897

Open an incremental text stream to participants. Returns a writer that can be used to send text chunks.

StreamTextOptions

Promise<TextStreamWriter>


unpublishTrack(track, stopOnUnpublish?): Promise<LocalTrackPublication | undefined>;

Defined in: client-sdk-js/src/participant/LocalParticipant.ts:586

Unpublish a track from the room.

MediaStreamTrack | LocalTrack

The track or MediaStreamTrack to unpublish.

boolean

Whether to stop the track after unpublishing. Defaults to RoomOptions.stopLocalTrackOnUnpublish (true).

Promise<LocalTrackPublication | undefined>


unpublishTracks(tracks): Promise<void>;

Defined in: client-sdk-js/src/participant/LocalParticipant.ts:1072

Unpublish all tracks matching the given sources, or all tracks if no sources specified.

LocalTrack[]

Promise<void>


updateFromInfo(info): void;

Defined in: client-sdk-js/src/participant/Participant.ts:272

ParticipantInfo

void

Participant.updateFromInfo


updateRoomState(key, value): Promise<void>;

Defined in: client-sdk-js/src/participant/LocalParticipant.ts:862

Update a key in the room’s shared state.

string

string

Promise<void>


waitUntilActive(): Promise<void>;

Defined in: client-sdk-js/src/participant/Participant.ts:209

Returns a promise that resolves once the participant is active and ready to receive data messages. Rejects if the participant transitions away from the active state first.

Promise<void>

Participant.waitUntilActive


static listenerCount(emitter, type): number;

Defined in: client-sdk-js/node_modules/.pnpm/@types+events@3.0.3/node_modules/@types/events/index.d.ts:4

EventEmitter

string | number

number

Participant.listenerCount