How to detect any of member in group call internet gets disconnect.
const checkPeerConnection = async () => {
// console.log('checkPeerConnection', id, peer);
try {
const connection = await peer.connect(id);
// const connection = await peer.getConnection(id, peer.connectionId);
// console.log('connection', connection);
connection.on('open', () => {
// console.log(' open');
setConnectionStatus('Connected');
});
connection.on('close', () => {
// console.log(' close error');
setConnectionStatus('Connection Closed');
});
connection.on('disconnected', () => {
// console.log(' disconnected error');
setConnectionStatus('Disconnected');
});
connection.on('error', (err) => {
// console.log(' error error');
setConnectionStatus('Error');
});
} catch (error) {
// console.log(' catch error');
setConnectionStatus('Error');
}
}
useEffect(() => {
const interval = setInterval(() => {
checkPeerConnection();
}, 5000);
return () => clearInterval(interval);
}, []);
None of event is trigger on internet disconnect on remote users device.I want to show remote users that one of the user has internet problem.