Live data from Hacker News

Building video chat into my personal website using WebRTC, WebSockets, and Go

mattbutterfield.com

31–40 of 68 posts

Re: Building video chat into my personal website using WebRTC, WebSockets, and Go

#31
post #30

Earlier quoted context omitted.

The only numbers I have ever seen published are Whereby's[0] they saw 17% used TURN. There is a little more nuance then just paternalistic networks though. In same cases like NAT Mapping exhaustion you just can't give an individual user multiple long lived mappings. Address Dependendent filtering/mapping also makes sense in some cases. It makes P2P harder, but does give you the ability to provide your users more sess…

We see about the same numbers Whereby does at Daily, globally across our whole user base. Bounces around a little but is usually just under 20%. Way more for customers that are mostly serving corporate users, of course (firewalls). And more for mobile-heavy user populations. Actually, that's a good reminder that it would be nice to understand the mobile data networks breakdown in more detail. Most of the US mobile da…

That is awesome, thanks for sharing :) Lots of little details and they all effect each other. I really enjoy networking because of this.

I wonder if we come back to this in 10 years what this number will be. Linux on the desktop and IPv6 is just around the corner...

Re: Building video chat into my personal website using WebRTC, WebSockets, and Go

#32

I tried this myself too and when I try p2p with 4 people, out of 10 tests about 50% of the time I won't be able to see all 4 people or someone wouldn't be able to see all 4 people. It was really hard to make p2p work and debugging the ice connections was even harder.

The worst one for me so far is mDNS not working on my local network so the one circumstance you should basically be able to guarantee an easy P2P connection doesn’t work.

Re: Building video chat into my personal website using WebRTC, WebSockets, and Go

#34
Im doing exactly this, but will use it with a raspberrypi with a 7 inch touch screen as my doorbell. Someone hits the link on the screen, it hits the server, server texts me a link to join the video session and thats it really. I got the core code going (I used a simple tornado [python] implementation as it has web sockets built in)

This is the version of the js code that I got going (I couldn't reason about straight inline scripting, I had to make unnecessary classes. you dont need them) https://gist.github.com/emehrkay/1ea9a87a91e00b27843d9b71a3c...

You also need to tell nginx to serve the wss connection with http 1.1 or the handshakes fail

``` location /websocket/path { proxy_pass http://whateverSiteDotCom; proxy_http_version 1.1; proxy_set_header Connection "upgrade"; proxy_set_header Upgrade $http_upgrade; proxy_set_header Origin ''; } ```

Re: Building video chat into my personal website using WebRTC, WebSockets, and Go

#35

I feel like part of the reason why software engineering projects are hard to estimate is this. So you want to add video chat.. - this blogpost: 100 loc - pion (open source): 100k loc? - dolby.io/ agora: I'm guessing >1m loc - zoom.... even more?

You made me curious about how large Pion is, 162k lines! I made sure to delete all test files first. sean@SeanLaptop:~/go/src/github.com/pion$ find . -type f -name '\*.go' | xargs wc 47871 162998 1394063 total pion/webrtc is the largest package with 58k lines. Every other package (ICE, DTLS, SCTP....) are all around 20k lines. It feels wrong that WebRTC is so large (and not pushed into sub packages) will for sure be…

There are:

- A lot of examples: https://github.com/pion/webrtc/tree/master/examples - A lot of tests - if you exclude `_test.go` and `examples/` you are down to ~58k loines, which is only ~3x bigger than the (much simpler!) ICE and SCTP packages.

With a naive exclude via grep -v '_test.go' and grep -v 'examples/*' we are down to:

   16180   58136  498113 total

Re: Building video chat into my personal website using WebRTC, WebSockets, and Go

#37

I feel like part of the reason why software engineering projects are hard to estimate is this. So you want to add video chat.. - this blogpost: 100 loc - pion (open source): 100k loc? - dolby.io/ agora: I'm guessing >1m loc - zoom.... even more?

To be fair this is a very simplistic project just to get the 2-way chat working. There are no fallbacks for anything that doesn't work correctly. There are also numerous edge cases especially iOS and Safari that would add 1,000 more lines of code to properly account for. Not too mention all the features that people actually want like muting, toggle video, noise detection/cancellation. So yeah, setting up a P2P video…

[deleted]

Re: Building video chat into my personal website using WebRTC, WebSockets, and Go

#38

Im doing exactly this, but will use it with a raspberrypi with a 7 inch touch screen as my doorbell. Someone hits the link on the screen, it hits the server, server texts me a link to join the video session and thats it really. I got the core code going (I used a simple tornado [python] implementation as it has web sockets built in) This is the version of the js code that I got going (I couldn't reason about straight…

Looks nice, here's the final working JS file from this blog post's example, no classes: https://github.com/m-butterfield/mattbutterfield.com/blob/88...

A bit dense, and could use some error handling...but it actually seems to work fine!

Re: Building video chat into my personal website using WebRTC, WebSockets, and Go

#40
post #5

Not quite so easy as the blog makes out... didn't see any mention of turn and stun servers, and multi-peer adds layers of complexity... To stably build a negotiation system you'll probably need an infrastructure of websockets and some kind of nosql db to handle identity and other quirks around negotiation... Example... how do you handle refresh from a new tab or after the connection has dropped... some kind of device…

WebRTC is complicated, its been around for a while and support in browsers have not been great in the past, which might be why Zoom first used WebSockets for video. They use WebRTC now though, and WebRTC is fine now, it is the standard , but potential is not the right word. Have a look at WebTransport to see a future alternative with potential. For those who are interested, the technical term is signalling (not negot…

Another great alternative: https://jitsi.org/projects/
Post reply on HN