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

reconnection not possible #24

Closed
yocontra opened this issue May 15, 2015 · 8 comments
Closed

reconnection not possible #24

yocontra opened this issue May 15, 2015 · 8 comments

Comments

@yocontra
Copy link
Collaborator

seems like this library treats closed and disconnected ICE states as destroyed, but disconnected can also mean that it was temporarily disconnected and is attempting to reconnect. we are seeing increased connection drops since switching to simple-peer since there is no way to let the peer run its natural reconnection processes

https://github.com/feross/simple-peer/blob/master/index.js#L324

@feross
Copy link
Owner

feross commented May 15, 2015

Just released v5.6.0 which doesn't destroy the Peer object when ICE becomes 'disconnected'. Let me know if that reduces the number of connection drops you're seeing.

feross added a commit that referenced this issue May 15, 2015
@yocontra
Copy link
Collaborator Author

testing it now, will let you know if it allows our reconnect logic to kick in

@feross
Copy link
Owner

feross commented May 18, 2015

Any update?

@yocontra
Copy link
Collaborator Author

Working smoothly again! In case anybody sees this later and is wondering - for reconnection set a timeout on disconnect to destroy unless connect has been emitted again.

@feross What do you think about an option for this?

@feross
Copy link
Owner

feross commented May 20, 2015

@contra Yes, this should be built into simple-peer. I'm noticing that sometimes the 'disconnect' ICE state happens, but never 'closed', so the peer never fires 'close' and lives on as a zombie. Adding a timer into instant.io would allow 'close' to eventually fire and give reconnect a chance to happen.

@codealchemist
Copy link

Hi guys!
After connecting two peers if I reload the second one I get this error on the initiator:
Error: InvalidStateError: Failed to set remote answer sdp: Called in wrong state: kStable

The peer connection and the data channel objects are destroyed.
How do you suggest handling this scenario?

Thanks!

@nazar-pc
Copy link
Collaborator

@codealchemist, apparently not, otherwise it wouldn't be in wrong state: kStable.
Look at your code again and make sure to actually destroy the instance and create a new one for re-created connection. WebRTC is tricky and sometimes you may get an issue that is not very obvious, but there should be one somewhere.

@codealchemist
Copy link

Thanks for your answer @nazar-pc.
I'll continue debugging.

Cheers!

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

4 participants