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

No error event when connecting to non existent peers #566

Closed
d07RiV opened this issue Aug 13, 2019 · 6 comments
Closed

No error event when connecting to non existent peers #566

d07RiV opened this issue Aug 13, 2019 · 6 comments

Comments

@d07RiV
Copy link

d07RiV commented Aug 13, 2019

This does not print anything:

const peer = new Peer();
const conn = peer.connect('this-id-does-not-exist');
conn.on('error', err => console.log(err));

Is there any way to distinguish failed connections, other than waiting for a timeout?

@afrokick
Copy link
Member

we use setTimeout to hangup an outgoing call after X seconds.

@d07RiV
Copy link
Author

d07RiV commented Aug 16, 2019

I'm doing the same but it seems highly suboptimal to have the client wait 5 seconds or so, when the server could respond with an error right away.

@d07RiV
Copy link
Author

d07RiV commented Aug 17, 2019

I looked into the server code and it seems the server is waiting for the potential client to connect/reconnect before timing out the request. Wouldn't it be better to detect that the client with given ID has not existed for a long time?

@afrokick
Copy link
Member

You're right.
We need to detect it and close broken connection. We already added the ping message from client to server. The next step will be implementing a function to clear connections for inactive clients.

@afrokick
Copy link
Member

Implemented in server peers/peerjs-server#139

@d07RiV
Copy link
Author

d07RiV commented Aug 22, 2019

Thanks, that should be very helpful!

@afrokick afrokick closed this as completed Sep 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants