most-army-32089
02/28/2025, 4:06 AMgray-monkey-83525
02/28/2025, 4:06 AMdeleteRoom
method from the LiveKit server API. This method will forcibly disconnect all participants and remove the room from the server. Here's a basic example:
1. Import and Setup: Ensure you have the LiveKit API client set up with your server URL, API key, and secret.
2. Delete Room: Call the deleteRoom
method with the room name.
import { LiveKitAPI } from 'livekit-server-sdk';
const apiClient = new LiveKitAPI(process.env.LIVEKIT_URL, process.env.LIVEKIT_API_KEY, process.env.LIVEKIT_API_SECRET);
async function endMeeting(roomName) {
try {
await apiClient.room.deleteRoom({ name: roomName });
console.log('Room deleted successfully');
} catch (error) {
console.error('Error deleting room:', error);
}
}
This will ensure that the room is deleted and all participants are disconnected. Would you like more details on setting up the API client or handling errors?
Sources:
- LiveKit Room Management
- Disconnecting Everyone 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.