
Untangling the WebRTC Flow - reimertz
https://www.pkcsecurity.com/untangling-webrtc-flow.html
======
moron4hire
> Step 9 · failure. Just log the error to console and call it a day.

There is not a single WebRTC guide that says anything else on the matter of
error handling. There is zero guidance on how to handle fail over, what parts
are recoverable, how to sequence multiple users joining a session at the same
time, what to do if the signal process hangs--basically anything other the
default one-to-one successful scenario. All we ever get is the same rehashing
of the signalling process, for the last 5 years now. It's ridiculously bad.

I think once you understand the handshake, it make a lot of sense. But the
success case is just one. And we don't need 20 guides on it with 0 on any
error cases.

I've probably read 90% of the available literature, including several full
length books. They pad their length with code listings, like people copy code
out of books anymore. You are on your own if you are trying to develop a good
app using WebRTC.

~~~
Hydraulix989
The best way to deal with this in my experience is by drawing out finite state
machines that cover all possibilities and ensure that every path through the
state machine ends up making forward progress towards a graceful error
recovery.

------
kodablah
I've found this[0] chapter has a great overview of WebRTC communication. I do
wish the transports were a bit more pluggable so I could use, say, an onion
service to bust NAT for me.

In general I believe WebRTC, as a set of multiple protocols, has too few full
implementations (i.e. w/ the stun/turn/ice server AND client sides, media
extensions, etc). I think with more implementations, WebRTC will become a
decent p2p standard even without the browser. I personally am starting to toy
w/ a Rust impl of some of the RFCs.

0 - [https://hpbn.co/webrtc/](https://hpbn.co/webrtc/)

~~~
tostitos1979
I've looked at WebRTC as well, and it is a mess. Consider websockets as a
protocol. So much cleaner and clearer. With WebRTC, you gotta know/implement
SIP, RTP, RTSP, RTCP????

~~~
kodablah
WebSockets are a completely different use case (i.e. client-server vs client-
client among other things).

Also, you don't need to know/implement those protocols, library abstraction
should help you avoid it. The low-level implementers do. That's like saying
you have to know the WebSocket protocol/upgrade details to use it.

~~~
skykooler
What's a good wrapper library that makes webrtc a bit simpler?

~~~
squidlogic
(author here) I've used SimpleWebRTC[0] in the past with success. It was
helpful once I needed to start dealing with the annoyances of cross browser
compatibility, multiparty calls, etc. You can also fork their code on
github[1], which is what I ended up doing.

[0] [https://simplewebrtc.com/](https://simplewebrtc.com/)

[1]
[https://github.com/andyet/SimpleWebRTC](https://github.com/andyet/SimpleWebRTC)

~~~
throwawaybbq1
Thanks for the nice writeup. You mentioned Javascript in the article. Is
webrtc tied to browsers and JS? Or can it be used by other clients too .. like
mobile apps or wearables?

~~~
1mike12
Not only for JavaScript. Googles duo app uses webrtc for instance

------
bhouston
One thing I could use is a Node.JS library for streaming MP4s and other vidoe
streams to WebRTC directly. Basically use WebRTC as a low latency streaming
video means.

~~~
kodablah
While I haven't investigated deeply, it might be worth looking at
[https://github.com/medooze/media-server-
node](https://github.com/medooze/media-server-node) and
[http://www.kurento.org/](http://www.kurento.org/).

------
shams93
This is a great article, if you look at webrtc support once Apple is out of
the yellow zone with safari we have across the board support for webrtc in all
browsers. Its still not a settled api so its pretty hair raising. My first
webrtc startup failed but now I'm working on replacing a legacy flash system
with webrtc, in this case with flash being phased out webrtc is the only
choice. This article is really well done this is going to help me give
something my cto can read and quickly understand so he fully "groks" what my
team is doing.

------
cooervo
Oh I see working with WebRTC is still difficult as hell.

~~~
1mike12
Lol, started working with it a month ago... Pretty much

