adorable-queen-16922
10/03/2025, 6:09 PMtall-airline-16756
10/03/2025, 6:09 PMtall-airline-16756
10/03/2025, 6:10 PMROOM_DELETED. It’s like the room no longer exists.
• Closing a room: This happens automatically when the last participant leaves. The great part is, you can always create a new room with the same name later on.
About WHIP, when a room is deleted, all existing WHIP sessions linked to that room end as well. So, WHIP will need to create a new token for any new session since the old session’s context is gone.
Sources: Avoiding Room ID Reuse When Re-Creating Rooms With the Same Name | pkg/whip/whip_proxy_handler.go | pkg/service/roommanager_service.go | Connecting to LiveKit | LiveKit Docsadorable-queen-16922
10/03/2025, 6:26 PMtall-airline-16756
10/03/2025, 6:26 PMdeleteRoom API: This is a quick way to end the session for everyone as soon as the WHIP connection closes.
• Let the room close automatically: If the room becomes empty after WHIP disconnects, it will close on its own after a set timeout. You can adjust the emptyTimeout and departureTimeout settings to make sure this fits your needs perfectly. Sources: Job lifecycle | LiveKit Docs | pkg/rtc/room.goadorable-queen-16922
10/03/2025, 6:39 PMtall-airline-16756
10/03/2025, 6:39 PMParticipantDisconnected event on the Room object. This event fires whenever a remote participant, like a publisher, leaves the room.
Here’s a simple example to guide you:
room.on(RoomEvent.ParticipantDisconnected, (participant) => {
console.log('Participant disconnected:', participant.identity);
// Handle disconnection of the publisher
});
By using this, you’ll be able to catch when a publisher disconnects and smoothly manage what happens next in your app. If you need any more help or have questions, feel free to ask!
Sources: Handling events | LiveKit Docs | src/room/Room.tsadorable-queen-16922
10/03/2025, 6:44 PMtall-airline-16756
10/03/2025, 6:44 PMParticipantDisconnected event into a React component—I'd be happy to help with that! Or, if you're looking for some general advice on using this event in JavaScript, just let me know.
If you're working with React, feel free to ask if you'd like some tips on setting up event listeners within the React component lifecycle, like using useEffect. I'm here to guide you through it!adorable-queen-16922
10/03/2025, 6:45 PMtall-airline-16756
10/03/2025, 6:45 PMParticipantDisconnected event within your React component! Using the useEffect hook is a great way to manage the lifecycle of your event listener smoothly. Here's a simple example to guide you:
import { useEffect } from 'react';
import { RoomEvent } from 'livekit-client';
function MyComponent({ room }) {
useEffect(() => {
const handleParticipantDisconnected = (participant) => {
console.log('Participant disconnected:', participant.identity);
// Handle disconnection logic here
};
// Add the event listener
room.on(RoomEvent.ParticipantDisconnected, handleParticipantDisconnected);
// Cleanup the event listener when the component unmounts
return () => {
room.off(RoomEvent.ParticipantDisconnected, handleParticipantDisconnected);
};
}, [room]); // Dependency array ensures this runs when the room changes
return My LiveKit Room;
}
export default MyComponent;
This approach makes sure your event listener is set up right when your component mounts and tidily removed when it unmounts. This way, you avoid any memory leaks or accidentally adding multiple listeners. If you have any questions or want to dive deeper, feel free to ask—I'm here to help!