openVidu - connectionDestroyed / sessionDisconnected event doesn't trigger when websocket connection lost because of network problem

572 views Asked by At

Publisher doesn't notify when connection is destroyed or diconnected. In Openvidu docs, they suggest connectionDestroyed & sessionDisconnected event but it doesn't trigger anymore. How can i solve this issue ? From publisher side i need to inform publisher while network is lost and connection is destroyed.

session.on('connectionDestroyed', reason => {
    //...
    //Doesn't trigger
});

session.on('sessionDisconnected', reason => {
    //...
    //Doesn't trigger
});

Updated:

sessionDisconnected event is invoked when i reconnect successfully or gracefully close the session. But i need to inform publisher immediately when internet connection is lost.

2

There are 2 answers

0
ASANIAN On

Try the following:

session.on('streamCreated', event => { }

and

session.on('sessionDisconnected', (event) => { }

Both are working for me.

1
PrashantAjani On

Not sure if Openvidu has changed the event names but you can also try following as per doc - here

session.on('streamDestroyed', reason => {
    //...
});