Docs
Node SDK

participants.remove

Disconnect one participant and remove their live media resources.

Import and client

TypeScript
import { RelayServer } from '@relayrtc/node'
 
const relay = new RelayServer({
  apiUrl: process.env.RELAYRTC_API_URL!,
  apiKey: process.env.RELAYRTC_SECRET_KEY!,
})

Requirements

A secret key with participants:remove. The requested resource must belong to that key's project environment.

Parameters

OptionTypeDefault / requirementPurpose
roomIdstringRequiredID of a room in the key's environment.
participantIdstringRequiredID of a participant in this room.

Every method accepts RequestOptions as its final argument.

Example

TypeScript
const roomId = 'room_example'
const participantId = 'participant_example'
const result = await relay.participants.remove(roomId, participantId)

Returns

Promise<CleanupResult>. Returns { status: 'completed', httpStatus: 204 } when cleanup finishes, or { status: 'pending', httpStatus: 202, operation } while cleanup is still running.

TypeScript
if (result.status === 'pending') {
  console.log(result.operation.id, result.operation.status)
}

Poll participants.getRuntimeOperation(roomId, participantId) until completed. A completed result has status: 'completed' and httpStatus: 204.

Behavior

This disconnects the participant

Removal affects the participant’s live session and tracks. Use this operation for moderation or administrative removal.

REST equivalent

DELETE /v1/rooms/{roomId}/participants/{participantId}. Failures throw RelayApiError.