Close Browser and Session user

17 views
Skip to first unread message

Melvin Gilberto

unread,
Dec 27, 2019, 3:05:47 PM12/27/19
to OpenVidu
How can I listen when a user closes the browser and take it out of the session?

Melvin Gilberto

unread,
Dec 27, 2019, 3:19:44 PM12/27/19
to OpenVidu
It is possible with
OpenVidu Webhook server and
OpenVidu Server CDR?

Pablo

unread,
Jan 2, 2020, 7:11:51 AM1/2/20
to OpenVidu
If you want to listen to events in your application backend, then OpenVidu Webhook is the way to go. If you want to listen to events in your frontend, then subscribe to the desired events using OpenVidu Browser library.

Regards

Pablo

unread,
Jan 2, 2020, 7:18:14 AM1/2/20
to OpenVidu
When some user closes the browser, OpenVidu will sooner or later know that the user left the session. If you have designed your front code to explicetely and gracefully leave the session just before the window closes, then if you are lucky enough, the user will normally leave the session, immediately triggering the expected events. But the ability to run this code will depend on the browser and the way it was closed.

If the browser is unable to send the "leave" operation before closing, then OpenVidu will notify the user left after not receiving the expected ping messages (this will take aroud 10 seconds). So finally other users will receive the expected events to manage the situation (you will see that the "reason" property is different for both cases, so you can differentiate users leaving "gracefully" and users leaving with no logical reason, such a network disconnection or forcing the termination of the app).
Reply all
Reply to author
Forward
0 new messages