refined-caravan-84858
09/09/2025, 11:15 AMtall-airline-16756
09/09/2025, 11:15 AMtall-airline-16756
09/09/2025, 11:16 AMrefined-caravan-84858
09/09/2025, 11:20 AMtall-airline-16756
09/09/2025, 11:21 AMGET /sessions/ for an overview of session data.
• GET /sessions/{SESSION_ID} for detailed participant info, including joinedAt and leftAt timestamps.
1. Calculate Connection Minutes: For each participant, calculate how long they were connected by using the joinedAt and leftAt times. For participants still active, just use the current time as the endpoint. Remember to exclude non-billable participants like ingress and egress users.
2. Group by Location: You can use the AnalyticsClientMeta fields (like region and country) to assign connection minutes to specific locations, which is super helpful for detailed insights.
3. Enable Real-Time Updates: To keep everything up to date, try polling the session details endpoint regularly (for example, every 60 seconds) so your data reflects real-time changes.
4. Display in a Dashboard: Finally, consider using a frontend framework like Bootstrap along with Chart.js to build a dashboard that updates dynamically. This way, you can easily track metrics like total connection minutes and usage by location.
If you’d like, I’m here to provide more details or even share some code examples for any of these steps—just let me know! I’m happy to help you every step of the way.
Sources: LiveKit Pricing | Analytics API | LiveKit Docs | livekit/livekit_analytics.pb.go | Understanding LiveKit Cloud Pricing | Say hello to improved Cloud analyticsrefined-caravan-84858
09/09/2025, 11:31 AMtall-airline-16756
09/09/2025, 11:31 AMrefined-caravan-84858
09/09/2025, 11:34 AMtall-airline-16756
09/09/2025, 11:35 AMcreatedAt, lastActive, numParticipants, and more. You’ll find active sessions in the API response, and you can spot them by looking at fields such as lastActive or other activity indicators.
That said, the API works on a polling model, so you’ll want to query the /sessions endpoint regularly to get updates. While it’s designed to help with real-time monitoring, there might be a tiny delay due to how the data is processed. For smooth tracking, setting up a polling interval—say, every 60 seconds—can help you fetch and show the latest session info consistently.
If you’d like, I’m here to help you set up the polling or walk you through understanding the API responses. Just let me know!
Sources: Say hello to improved Cloud analytics | Analytics API | LiveKit Docsrefined-caravan-84858
09/09/2025, 11:38 AMtall-airline-16756
09/09/2025, 11:39 AMleftAt is there, you can find the duration by:
Duration = (leftAt - joinedAt)
• If leftAt isn’t there (meaning they’re still active), just use the current time:
Duration = (currentTime - joinedAt)
1. Convert to Minutes: Since the timestamps are in milliseconds, divide by 60,000 to get minutes:
ConnectionMinutes = Duration / 60000
2. Sum Up for the Session: Add all participants’ connection minutes to find the total for that session.
3. Group by Location: If you want to group by location, simply add up the connection minutes for all sessions linked to a specific location ID.
If anything feels unclear or if you'd like me to share a code example to make this even easier, just let me know—I’m here to help!refined-caravan-84858
09/10/2025, 5:53 AMGET /sessions API, which can get pretty bloated, why not call list_rooms from RoomService every minute to fetch the active rooms? You could then take each session ID from that list and push it into the queue for processing.tall-airline-16756
09/10/2025, 5:54 AMlist_rooms method from RoomService to fetch active rooms and work with session IDs for real-time tracking. This can actually be a smoother way compared to relying solely on the GET /sessions API, especially when you’re focusing on active rooms.
Here’s a friendly step-by-step to help you get started:
1. Fetch Active Rooms: Use the list_rooms method to get a list of rooms that are currently active. Just a heads-up, you’ll need the roomList permission for this.
2. Retrieve Participant Data: For each active room, call list_participants to gather details about all participants, including their session IDs (SIDs).
3. Process Session IDs: You can then push these session IDs into a queue to handle things like calculating connection minutes or grouping participants by location.
Here’s a simple example in Python to illustrate:
rooms = await lkapi.room.list_rooms(ListRoomsRequest())
for room in rooms.rooms:
participants = await lkapi.room.list_participants(ListParticipantsRequest(room=room.name))
for participant in participants.participants:
print(f"Participant SID: {participant.sid}")
I hope this helps you track active rooms and participants smoothly in real time. If you’d like, I’m here to assist with more examples or anything else you might need!
Sources: livekit/livekit_room.twirp.go | examples/api.pyrefined-caravan-84858
09/10/2025, 5:55 AMlist_rooms methodtall-airline-16756
09/10/2025, 5:56 AMrefined-caravan-84858
09/10/2025, 7:11 AM