participants.remove
Disconnect one participant and remove their live media resources.
Import and client
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
| Option | Type | Default / requirement | Purpose |
|---|---|---|---|
| roomId | string | Required | ID of a room in the key's environment. |
| participantId | string | Required | ID of a participant in this room. |
Every method accepts RequestOptions as its final argument.
Example
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.
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
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.