Skip to main content

ChannelWebRtcClient

ChannelWebRtcClient: TypedEventEmitter<ChannelWebRtcEvents> & object

Type declaration

kick()

Parameters

ParameterType
requestChannelWebRtcKickRequest

Returns

Promise<void>

Example

import {
ChannelWebRtcMuteAndDeafenRequest,
ChannelGuid,
UserGuid,
DeviceGuid,
rootServer,
} from "@rootsdk/server-app";

export async function kickExample(
channelId: ChannelGuid,
userId: UserGuid,
deviceId?: DeviceGuid,
): Promise<void> {
try {
// Set up the request
const request: ChannelWebRtcKickRequest = {
channelId: channelId,
userId: userId,
deviceId: deviceId,
};

// Call the API
await rootServer.community.channelWebRtcs.kick(request);
} catch (error) {
// Detect error
throw error;
}
}

Authorization

Declare the following permissions in your manifest:

"permissions": {
"channel": {
"VoiceKick": true
}
}

The community must also create channel access rules that give your code any needed visibility but don't deny these permissions via an overlay:

  • VoiceKick on the channel

list()

Parameters

ParameterType
requestChannelWebRtcListRequest

Returns

Promise<ChannelWebRtcListResponse>

Example

import {
ChannelWebRtcListRequest,
ChannelWebRtcListResponse,
ChannelGuid,
rootServer,
} from "@rootsdk/server-app";

export async function listExample(
channelId: ChannelGuid,
): Promise<ChannelWebRtcListResponse> {
try {
// Set up the request
const request: ChannelWebRtcListRequest = {
channelId: channelId,
};

// Call the API
const response: ChannelWebRtcListResponse =
await rootServer.community.channelWebRtcs.list(request);

return response;
} catch (error) {
// Detect error
throw error;
}
}

setMuteAndDeafenOther()

Parameters

ParameterType
requestChannelWebRtcSetMuteAndDeafenOtherRequest

Returns

Promise<void>

Example

import {
ChannelWebRtcSetMuteAndDeafenOtherRequest,
ChannelGuid,
UserGuid,
rootServer,
} from "@rootsdk/server-app";

export async function setMuteAndDeafenOtherExample(
channelId: ChannelGuid,
userId: UserGuid,
isMuted?: boolean,
isDeafened?: boolean,
): Promise<void> {
try {
// Set up the request
const request: ChannelWebRtcSetMuteAndDeafenOtherRequest = {
channelId: channelId,
userId: userId,
isMuted: isMuted,
isDeafened: isDeafened,
};

// Call the API
await rootServer.community.channelWebRtcs.setMuteAndDeafenOther(request);
} catch (error) {
// Detect error
throw error;
}
}

Authorization

Depending on your usage, you may also need to declare:

  • VoiceMuteOther if setting isMuted
  • VoiceDeafenOther if setting isDeafened