event 'DataConnection: close' not fired if peer connection is disconnected #41

Closed
MatthiasLohr opened this Issue Apr 3, 2013 · 6 comments

Projects

None yet

2 participants

Contributor

If the connection to the peer is disconnected with Peer.disconnect(), the close-event for DataConnections is not fired after one of the peers has gone.

@MatthiasLohr MatthiasLohr referenced this issue in MatthiasLohr/PeerChess Apr 3, 2013
Open

display message if opponent has left the game #8

Owner
michelle commented Apr 3, 2013

This is tricky because the close event is currently best handled through the server, when a peer reports that it has left.

Currently DataChannel.onclose, the handler that is supposed to fire when the underlying transport is closed does not fire reliably. I will look into whether some of the other handlers (PeerConnection.oniceconnectionstatechange, PeerConnection.onreadystatechange, etc) would help with this.

Owner
michelle commented Apr 3, 2013

Just looked into it. PeerConnection.oniceconnectionstatechange is the one to look at. I will make this change tonight.

Edit: this has a slight problem: it will only be effective when the PeerConnection is closed, so still won't solve the issue of no close when there are multiple DC.

@michelle michelle added a commit that referenced this issue Apr 4, 2013
@michelle michelle oniceconnectionstatechange handler added, partially deals with #41 ex…
…cept for multiple DC
336b075
Owner
michelle commented Apr 4, 2013

For the multiple DC case it might just be best at this point to catch DOM exceptions from sending on a closed DC and closing it from there. Need to think about this more though.

Contributor

Anything new about this topic?

Owner

Nothing new from a native API standpoint. I'm currently on vacation so I'll be quite delayed in getting things done. If you think of a good solution please do make a pull request--I'll be checking those more often :).

Owner

Update: The DataChannel does close after something like 5-10 seconds. If there's a specific set of steps where you can get this to reproduce consistently feel free to reopen.

@michelle michelle closed this Jun 24, 2013
@bchu bchu pushed a commit to bchu/peerjs that referenced this issue Jun 29, 2013
@michelle michelle oniceconnectionstatechange handler added, partially deals with #41 ex…
…cept for multiple DC
69fb0a5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment