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

Handling broken connections #769

Open
Niksac opened this issue Dec 14, 2020 · 3 comments
Open

Handling broken connections #769

Niksac opened this issue Dec 14, 2020 · 3 comments
Labels
client related to peerjs client

Comments

@Niksac
Copy link

Niksac commented Dec 14, 2020

I'm testing with latest peerjs and two latest version chrome browsers.

When i connect two peers using peerjs and then shutdown the network, the connection "close" event does not fire.

The connection's readyState stays OPEN and I do not notice the disconnect in code.
The connection will not recover when I restore the network.
I get a "close event" after something like 10 minutes and only as a result of using send() on the connection.

The peerjs control connection fires its handlers much faster.

My question is: how to handle such disconnects. Do I need to implement my own kind of heartbeat between the clients?
Can i utilize the websocket's "ping" functionality for that or is there an even better way?

@newelement
Copy link

I have the same question, but in my situation it is using the navigator.mediaDevices.getDisplayMedia. When the browser's dialog opens to allow a user to close the screen share it is the same as @Niksac mentioned. It does not fire a close event thus locking up all other peers with a frozen frame from the screen share.

@DirkHeinke
Copy link

I'm wondering if a better heartbeat should be in the library or if everyone program should have its own implementation. Did you solve your problem @Niksac?

@Niksac
Copy link
Author

Niksac commented Feb 21, 2021

@DirkHeinke no, it's still on my "to fix" list.
A heartbeat in the library would definitely be cool for people not as knowledgeable in socket stuff (like me).

@irgalamarr irgalamarr added the client related to peerjs client label Feb 24, 2024
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

4 participants