happy-diamond-58115
11/03/2025, 3:55 AMtall-airline-16756
11/03/2025, 3:55 AMtall-airline-16756
11/03/2025, 3:56 AMRoom class to listen for important events like Disconnected. For instance, detecting when a room closes is possible by checking for DisconnectReason.ROOM_CLOSED or DisconnectReason.ROOM_DELETED. This way, you’ll be able to understand why a disconnection happened and spot room closures or errors easily.
• Server-Side Monitoring: Another great option is setting up webhooks to catch events like room_finished when a room closes. Webhooks are super reliable and will notify you about room lifecycle events, even if no clients are connected at that moment.
Here's a simple example to help you monitor disconnection reasons:
room.on(RoomEvent.Disconnected, (reason) => {
if (reason === DisconnectReason.ROOM_CLOSED) {
console.log('Room was closed');
} else {
console.log('Disconnected for another reason:', reason);
}
});
By combining these client-side event listeners with server-side webhooks, you’ll have a well-rounded way to monitor room errors and closures. If you have any questions or need further help, feel free to ask—I’m here to support you!
Sources: Connecting to LiveKit | LiveKit docs | agent-console/app/room/page.tsx | Server-Side SDKs & Authentication | livekit/livekit_composite | DeepWiki | Events and error handling | LiveKit docshappy-diamond-58115
11/03/2025, 4:00 AMtall-airline-16756
11/03/2025, 4:01 AMlivekit-rtc package) just for that. This SDK lets your server-side apps connect to rooms as participants, publish and subscribe to audio, video, and data, and interact with the room in a flexible way.
For server-side scenarios like bots, recording agents, or AI integrations, using the Node.js Realtime SDK is definitely the best path. The standard livekit-client SDK isn’t really meant to be used directly on the server. If you have any questions about getting started or need help along the way, feel free to ask—we’re here to support you!
Sources: README.mdhappy-diamond-58115
11/03/2025, 4:03 AM@livekit/rtc-node?tall-airline-16756
11/03/2025, 4:03 AM@livekit/rtc-node. This SDK is designed to help you connect to a room and keep an eye on participant and track states, while also letting you listen to real-time events like these:
• `TrackSubscribed`: When you subscribe to a remote track
• `ParticipantConnected`: When a new participant joins
• `ParticipantDisconnected`: When a participant leaves
• `TrackPublished`: When a participant publishes a new track
• `Disconnected`: When the connection to the room is lost
Here’s a simple example to get you started with monitoring events:
room
.on(RoomEvent.TrackSubscribed, (track, publication, participant) => {
console.log(`${participant.identity} published ${track.kind}:`, track.name);
})
.on(RoomEvent.ParticipantConnected, (participant) => {
console.log(`Participant ${participant.identity} joined`);
})
.on(RoomEvent.Disconnected, () => {
console.log('Disconnected from room');
});
Just a quick heads-up: @livekit/rtc-node is currently in Developer Preview, so it’s best to avoid using it in production for now. If you have a specific scenario in mind or need help with an example, feel free to ask—I’m here to help!
Sources: packages/livekit-rtc/CHANGELOG.md