Support & information center

Adding custom events in watchRTC

Your application has its own set internal logic hat is outside the scope and context of WebRTC itself. As such, the watchRTC SDK cannot be aware of these events and track them on its own. In order to be able to enrich watchRTC with such events, making its more powerful and useful when you need to analyze certain sessions, you can use the custom events mechanism in watchRTC.

By using watchRTC.addEvent() API available in the watchRTC SDK, you can instruct watchRTC to add such events to its tracking of the session.

A custom event in watchRTC has two parameters to it: name and type. The name is an arbitrary string describing the event while the type indicates how watchRTC should treat this event. There are 3 types of events:

  1. log – this event will appear only on the event log in the Advanced WebRTC Analytics for the peer and nowhere else. You’ll be able to track and correlate it along with all other API calls and callbacks that watchRTC tracks
  2. local – this event will appear in the event log in the Advanced WebRTC Analytics as well as on the peer level charts. When you will drill down to look at the peer information, the event will show as a vertical line on the charts
  3. global – this event will appear in the event log in the Advanced WebRTC Analytics, the peer level charts and the room level charts

Here is how custom events appear in the events log:

Here is how you’ll see custom events on charts:

Was this article helpful?

Related Articles