Docs
Node SDK

rooms.end

End the call and remove its live runtime 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 rooms:end. The requested resource must belong to that key's project environment.

Parameters

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

Every method accepts RequestOptions as its final argument.

Example

TypeScript
const roomId = 'room_example'
const result = await relay.rooms.end(roomId)

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 rooms.getRuntimeOperation(roomId) until completed. A completed result has status: 'completed' and httpStatus: 204.

Behavior

This ends the call for everyone

Ending a room disconnects its participants and removes its live media resources. To leave only one browser participant, use the browser SDK’s leave method.

Poll the room runtime operation when the response is 202.

REST equivalent

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