Webhook event latency

we’re using the Video SDK webhook (session.user_joined, session.user_left) to calculate the duration of video calls between two users. However, we sometimes receive these events with significant delays—ranging from 3–4 minutes to over 30 minutes after the session has ended(session.ended).

Could you help investigate the following sessions and clarify when these delays occur?

Session IDs: kEuFRd/MSBiZr4RKN6QVlA== ; Xn9KKrd4T5GlDB650z7ZCQ== ; u8cIXa3TT3OC6DIvDq935A== ; f9yoALBTTauVDoL+gK39Fg==

I’ve experienced similar delays with the session events, especially with session.user_joined and session.user_left not syncing up immediately after the call ends. It’s pretty inconsistent—sometimes it’s just a few minutes, but I’ve also seen cases where the delay stretches to 30 minutes or even more, like what you’re describing. For example, in my case, I had delays with sessions like [session ID examples], which made calculating the actual duration pretty tricky.

It seems like these events don’t always push out in real time, especially during peak usage times. If you’re tracking call durations closely, this can definitely cause a bit of confusion in the logs. Hope this helps give a bit of context!

1 Like

I’ve been exploring potential workarounds, but the inconsistent timing of these events complicates things. It’d be helpful to understand if the Video SDK team is aware of this delay and if there’s any roadmap for improving real-time accuracy, especially for time-sensitive applications. Has anyone else faced this, or does anyone have suggestions on alternative methods to capture accurate session durations?

1 Like

Does the object in user_left show the incorrect time in the data as well?

{
  "event": "session.user_left",
  "event_ts": 1,
  "payload": {
    "account_id": "…",
    "object": {
      "id": "…",
      "session_id": "…",
      "session_name": "…",
      "session_key": "…",
      "user": {
        "id": "…",
        "name": "…",
        "leave_time": "2024-11-06T11:47:56.333Z", <- is this time delayed?
        "leave_reason": "…",
        "user_key": "…",
        "phone_number": "8615250064084"
      }
    }
  }
}

You can also utilize the session.ended which would have the start and end time.

{
  "event": "session.ended",
  "event_ts": 1,
  "payload": {
    "account_id": "…",
    "object": {
      "id": "…",
      "session_id": "…",
      "session_name": "…",
      "session_key": "…",
      "start_time": "2024-11-06T11:47:56.333Z",
      "end_time": "2024-11-06T11:47:56.333Z"
    }
  }
}

Webhooks are asynchronous and can be delayed by multiple factors.

The Video SDK also offers events directly that are real-time. You can use user_added and user_removed to log when a user joins or leaves.