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

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.



Solution 1:[1]

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

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

Solution 2:[2]

Try the following:

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

and

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

Both are working for me.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 PrashantAjani
Solution 2 Leepians