You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm creating a application and using free PeerJS server to share screen or camera.
while testing, I try to cut one PC's WiFi down and reopen the WiFi after disconnect event is fired. But reconnect only works sometimes.
after I call reconnect, nothing happens. No event, no connect, no error.
the status which PeerJS offer, like open、destory will stay false. Only disconnect will change to false after I call reconnect.
If I try to recoonect it again, the result wont change.
after I open the debug of server, it shows the steps and we can see it's not get the message:
"try to reconnect..."
PeerJS: Attempting reconnection to server with ID ****
PeerJS: Socket open
// end, no next one
it should be like this
"try to reconnect..."
PeerJS: Attempting reconnection to server with ID ****
PeerJS: Socket open
PeerJS: Server message received: { type: 'OPEN' } // we're missing this one
// next: fire the open event
here is my code
let peerConnection = new Peer()
let reconnectInterval: any
peerConnection.on('open', () => {
console.log('open')
if (reconnectInterval) {
window.clearInterval(reconnectInterval)
reconnectInterval = undefined
}
})
peerConnection.on('error', (e) => {
console.error('peer error, error = ' + e)
})
peerConnection.on('disconnected', (e) => {
console.error('peer disconnected, error = ' + e + ', ' + new Date())
if (!reconnectInterval) {
reconnectInterval = setInterval(() => {
if (!peerConnection.destroyed && !peerConnection.open) {
console.log('try to reconnect...')
try {
peerConnection.reconnect()
} catch (e) {
console.error('reconnect error, error = ' + e)
}
}
}, 5000)
}
})
does anyone know about this?
How can we reproduce the issue?
No response
What do you expected to happen?
if can't reconnect, it will fire event to try again, and return evey error or fire event.
PR fix by @hissinger appears to work for me. I was just dealing with this exact issue and wondering why nothing gets called after reconnect. I noticed this when I was switching between wifi networks and checking how my app reacts to it.
Please, check for existing issues to avoid duplicates.
What happened?
hello, I'm using Vue 3 with PeerJS.
I'm creating a application and using free PeerJS server to share screen or camera.
while testing, I try to cut one PC's WiFi down and reopen the WiFi after disconnect event is fired. But reconnect only works sometimes.
after I call reconnect, nothing happens. No event, no connect, no error.
the status which PeerJS offer, like
open
、destory
will stayfalse
. Onlydisconnect
will change to false after I call reconnect.If I try to recoonect it again, the result wont change.
after I open the debug of server, it shows the steps and we can see it's not get the message:
it should be like this
here is my code
does anyone know about this?
How can we reproduce the issue?
No response
What do you expected to happen?
if can't reconnect, it will fire event to try again, and return evey error or fire event.
Environment setup
Is this a regression?
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: