question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

is it impossible to make a simple webrtc connection reliably!?

See original GitHub issue
  simplepeer.min.js:6 Uncaught Error: Connection failed.
  at p._onConnectionStateChange (simplepeer.min.js:6)
  at RTCPeerConnection._pc.onconnectionstatechange (simplepeer.min.js:6)

happens in all browsers, on all my computers, all of my friends computers, all webrtc projets, and even on localhost. usually it connects fine, but sometimes it just gets stuck.

this is not a bug with simple-peer, this is a bug with webrtc. i came here expecting simple-peer to have retries built in or something to solve this. am i the only person with this issue or does everyone just accept it??? it’s so annoying and has been happening with many projects for many years now. .

even your simple demo where you copy/paste the signals will fail sometimes if you do it enough times. image

i dare you to try any webrtc demo about 20 times, it will get stuck.

sorry for venting my frustrations here but i’ve been working on a webrtc project off and on for about 3 years now and i still can’t connect reliably. any help is appreciated

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:14
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
farzhercommented, Mar 18, 2021

do you know what a TURN server is? that’s literally the “we failed to connect, let’s just give up on p2p and make a normal laggy server relay connection”

no, that’s not a solution i want. especially when it fails to connect at random and uses the TURN server at random. that was actually one of the biggest bugs i had in my app. was why the heck i’m getting 70ms ping on a localhost connection. works way better now that i removed the TURN server

0reactions
felquiscommented, Dec 24, 2021

I’ve been studying it since 2018 on my spare time, I saw some people moving to native WebRTC browser API the problems are the same but since you control the code you might not fall into design decisions that are particular to simple-peer.

Honestly, I think simple-peer would be a better lib if it could add CHANGELOG file for release notes, it helps us keep up to date on it overtime. But, I love it and I’m grateful cause I’ve played a lot with WebRTC with it and I get it is hard for maintainers to keep a popular side project like this one.

I haven’t built any corp program with it cause I don’t feel confident using it on comercial products, so this is my toy lab because I just never know when it breaks and it can refuse to connect for many many reasons far away from my ability to understand it hahaha so yeah shout out for you all people, good luck with p2p in 2022 and share all your gotchas publicly so I can find it later and use it as well hopefully.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Establishing a connection: The WebRTC perfect negotiation ...
This article introduces WebRTC perfect negotiation, describing how it works and why it's the recommended way to negotiate a WebRTC connection ...
Read more >
WebRTC Made Simple - Medium
WebRTC Made Simple. WebRTC is a set of JavaScript APIs that enable peer-to-peer, realtime communication between web browsers.
Read more >
Get started with WebRTC - web.dev
The codecs and protocols used by WebRTC do a huge amount of work to make real-time communication possible, even over unreliable networks:
Read more >
Implementing a simple WebRTC signaling mechanism with ...
But first, what is WebRTC? WebRTC is a browser technology that allows exchanging data among N peers via either the UDP or TCP...
Read more >
Taming WebRTC with PeerJS: Making a Simple P2P Web Game
For example, in Chrome 30 or older, only unreliable data channels were available. PeerJS, if configured to use reliable data channels, would use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found