peers / peerjs

Simple peer-to-peer with WebRTC.
https://peerjs.com
MIT License
12.48k stars 1.43k forks source link

Peer continues to exist after page closure #565

Closed webseta closed 5 years ago

webseta commented 5 years ago

So recently we needed to restart our peerjs server as after months of uptime it went down. I wasn't the one doing it, I'm not dealing with the backend. Anyway, everything seemed to be in order, but now I started seeing something strange. Peers are persisting even after the pages they are created in get closed. The dataconnection between an actually existing peer and one that should have been destroyed and disconnected remains open.

Am I doing something wrong, am I misunderstanding how peer.js works or is this some kind of bug? In any case, this wasn't the behavior I was experiencing before...

afrokick commented 5 years ago

Yep, I think the client should be destroyed after disconnected, but WS doesn't fire 'close' event in some cases. We check 'died' connections periodically. But i think we need to add sessions mechanism to logout previous user when the same user login again.

webseta commented 5 years ago

But what has changed? Just a couple weeks ago it wasn't the case. Closing the page resulted in the peer becoming destroyed, the dataconnection closed.

afrokick commented 5 years ago

It depends on how the browser tab was closed.

we added check function to server https://github.com/peers/peerjs-server/pull/139

afrokick commented 5 years ago

If this issue still exists - leave a new comment please.