Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error event not triggered #626

Open
tiofabby opened this issue Feb 10, 2020 · 4 comments
Open

error event not triggered #626

tiofabby opened this issue Feb 10, 2020 · 4 comments
Labels
client related to peerjs client

Comments

@tiofabby
Copy link

tiofabby commented Feb 10, 2020

Hello,
I am able to send data between two peers, using your peerjs-server (v0.2.9) without any issues and it works fine.
Only problem I am facing is that if one of the 2 peers is offline, the peer.connect() to such user (being offline) will never trigger the 'error' event even if we listen to it.
Is it on purpose or am I missing something?

Please note also that if peer is online at the beginning, I am then able to connect to it. Then if such peer gets OFFLINE suddenly, then in that case the 'error' event is correctly triggered!!

So the issue here is only when peer is offline since the beginning and we are never able to connect to it, then in that case, the 'error' event is never triggered.

Thank you
Fabrice


    myConnections[peerId] = peer.connect(peerId)
    myConnections[userPeerId].on('error', function(err) {
      Log.error('Error with connection', userPeerId, err)
      // NEVER GETTING HERE WHEN PEER IS ALREADY OFFLINE
    })

@begoat
Copy link

begoat commented Feb 19, 2020

@tiofabby Hi, tifabby. I came across the same problem.
I caught error in the error callback of peer object temporarily, according to the doc

peer.on('error', function(err) { ... });
// Errors from the underlying socket and PeerConnections are forwarded here.

@tiofabby
Copy link
Author

Hello @begoat
Thanks for your feedback but I had that in place already and if I try to connect to a peer not being connected to the server, the peer.on('error', function(err) { ... }) is not being triggered neither.

I am thinking about putting a Timeout to close these ghost connections never being opened.. but I would prefer peerjs to have these detected so I can trigger their closing automatically.

Thanks

@begoat
Copy link

begoat commented Feb 19, 2020 via email

@tiofabby
Copy link
Author

Hi @begoat
No the peerjs server is not generating any errors.
Logs are only showing who is connected or who gets disconnected but no error regarding the fact that someone asked for a connection that cannot be established.
Thank you
Fabrice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client related to peerjs client
Projects
None yet
Development

No branches or pull requests

3 participants