feross / simple-peer

📡 Simple WebRTC video, voice, and data channels
MIT License
7.44k stars 974 forks source link

Firefox cannot connect after refreshing the page from localhost #679

Open mrozbarry opened 4 years ago

mrozbarry commented 4 years ago

System

To reproduce

I'm using this repo to test things out, and I'm 99% sure the issue is not simple-peer, but I just want to step through everything that could be the problem.

Issue

When I run my app (yarn start) locally, and open a fresh firefox instance, my webrtc peer offer and other signals work exactly as expected. If I refresh the page, I get the initial offer signal, but then an error (with trickle on and off):

WebRTC: ICE failed, add a TURN server and see about:webrtc for more details
Peer error Error: "Ice connection failed."
    makeError index.js:18
    _onIceStateChange index.js:681
    oniceconnectionstatechange index.js:116

To be clear, this seems to mostly be an issue with localhost. I deployed my app on netlify and Firefox seems to behave well, or at least I haven't observed the same issues I see on localhost. On chrome, things appear to work find in any case.

I have similar issues with PeerJS as well, but PeerJS appears to have identical issues on both localhost and a deployed domain.

Otherwise, I'm not really sure how to go about debugging this. I have a pretty decent understanding of TCP/UDP sockets on a system level, but I'm not 100% clear on all the effort of doing web peer to peer.

vj-abishek commented 4 years ago

I also had this issue a long time ago. I had this issue with native web-rtc and not with simple-peer. My offer got send but it fails to produce an answer. But after some days, the error stopped appearing. I had this error in chrome.

Similar issue

For me simple-peer is working perfectly in localhost and my server. But When I tried to share signalling data in my LAN network it seems not working.

I tried to share signalling data with localhost and my network. The data is been transferred but it is not connecting. I don't know is that an issue. I'm using socket.io to send signalling data. socket.io is working but simple-peer is not connecting.

I test it with my PC and mobile

t-mullen commented 4 years ago

This is indeed a Firefox bug I've encountered before and is unrelated to simple-peer.

We need a native reproduction case to open this in bugzilla.

bmz1 commented 3 years ago

I've encountered similar problem in Firefox to Firefox relation only.

After refreshing the page it generates a huge amount (50+) of iceCandidates somehow, and cannot connect again. I recreate the peers on both sides when a refresh occurs, but I cannot make it work.

hthetiot commented 3 years ago

See https://github.com/feross/simple-peer/issues/819#issuecomment-930498088