Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

Websocket stays connected even after webrtc-star listener is closed #51

Open
michaelfakhri opened this issue Dec 11, 2016 · 2 comments
Open
Labels
status/ready Ready to be worked

Comments

@michaelfakhri
Copy link
Contributor

When the webrtc-star listener is closed, the web-socket connection to the signalling server remains active. This causes a few problems:

  • Causes exceptions in testing when signalling server is restarted (moch test -> karma tests) since the connection was never fully disconnected. This happens when the connect event on the socket is re-triggered, which in turn makes the listener rejoin the network after leaving it on close..
  • Leaving the Web-socket connected has no real advantages since the listener cannot be restarted after it is closed at the swarm level.

In order to rectify this, the socket connection can be closed if:

listener.io.disconnect()

is added before this line ->

listener.emit('close')

Let me know, what do you think about this change? if you like it and think its good, I can turn into a PR.

Thanks

@daviddias
Copy link
Member

Hi @michaelfakhri, great catch! I believe your proposal solution is correct, just needs one more thing. Since several listeners can be open within the same WebRTC Star instance, you need to make sure that all the listeners were closed before disconnecting from the WebSockets server.

One more thing, always feel welcome to submit a PR, even if it is a work in progress :)

@daviddias daviddias added the status/ready Ready to be worked label Dec 12, 2016
@michaelfakhri
Copy link
Contributor Author

michaelfakhri commented Dec 12, 2016

Hey @diasdavid I am not sure closing all the listeners is necessary in this case, since this module forces a new socket connection for every listener ->

'force new connection': true
.
&&
listener.io = io.connect(sioUrl, sioOptions)

Great! :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status/ready Ready to be worked
Projects
None yet
2 participants