Live data from Hacker News

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

mattbutterfield.com

51–60 of 68 posts

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

#51

Earlier quoted context omitted.

iOS and Safari is riddled with WebRTC bugs like this. Sounds similar to my experience. Everything consistently works great in Chrome and Firefox and then only kinda works Safari. worst browser on the planet

I've jokingly referred to Safari as SafarIE for the last 5 years. It does tick all these boxes: 1. Backed by an OS manufacturer that doesn't care about the web 2. Spends more time working on features that suit itself than meeting standards agreed upon by a body of which they're a part. 3. The only sanctioned/allowed browser on their platform (MS didn't even achieve this holy grail) 4. Lagging behind most other popula…

SafarIE?!

Bahaha, brilliant.

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

#52

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…

This code works fine in iOS safari (and desktop chrome, Firefox, and safari). I've seen a few comments on how mobile safari has pitfalls or is the new IE, but there isnt any specific code there for safari. it all just works

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

#53

Earlier quoted context omitted.

iOS and Safari is riddled with WebRTC bugs like this. Sounds similar to my experience. Everything consistently works great in Chrome and Firefox and then only kinda works Safari. worst browser on the planet

I've jokingly referred to Safari as SafarIE for the last 5 years. It does tick all these boxes: 1. Backed by an OS manufacturer that doesn't care about the web 2. Spends more time working on features that suit itself than meeting standards agreed upon by a body of which they're a part. 3. The only sanctioned/allowed browser on their platform (MS didn't even achieve this holy grail) 4. Lagging behind most other popula…

The cycle repeats itself, maybe it's a successful pattern, that's why it keeps coming back..

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

#54
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…

Essentially we enable in-browser comms (including but not limited to WebRTC for video and audio streams on top of storefronts).

Given we allow anonymous connections, we need to associate each WebRTC connection with user defined data (read user profile). It's not quite as simple as "a cookie" because one user can have multiple devices, updated user information has to sync across the other connections and for a smooth experience you have to have synced connection statuses.

We did look at syncing all this with RTC data channels, problem... you can't get message history and you also can't depend on the channel until after a successful negotiation, which again for us is only part of the larger infrastructure...

This forces the use of a parallel comms system such as websockets, allowing for event based synchronisation as well as the organisation of the WebRTC metadata both pre and post connection...

Most people don't want "naked javascript" with two faces on it, and WebRTC is a fantastic tool for video and audio streaming, however it is limited in its wider use (which is perfectly fine it does enough!)...

I think the problem is that people associate "video chat" with simply the media streaming, whereas the reality is that integrating it into a feature rich front end framework is significantly more complicated, and not simply a case of "adding a cookie"

The difference between the solutions you posted and websockets is as far as I can tell, "your own websockets" or "pay someone else to run your websockets".

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

#55
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…

https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/... also the term for a signalling server is "signalling" the term for negotiation is "negotiation".

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

#56

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?

It makes sense that video chat would be complicated though. Skype came out, what, 2003? And it didn't start becoming popular until years later. FaceTime came out 2010. I would bet the vast majority of people had their very first video chat experience some time in the past decade.

So of course it's hard. Nothing is built with video chat in mind, especially nothing that's existed for 30+ years like the Web. Our solutions are janky and feel bolted-on because they are.

Also, I think video (especially live-streamed video) is hands-down the hardest format to work with in computing. It's simultaneously network, disk, memory, and processor intensive, and doubly so with 2+ streams at the same time. We try to fix some of this with compression, but that just makes the codecs more complex, which makes it harder to work with...

Truth is though, you could "just add video chat," if you accept using a video chat vendor, of which there are probably hundreds (WebEx, Google Meet, Microsoft Teams, Discord, off the top of my head). But that means offloading the complexity to someone else. In many cases that's the right call. In OP's case this was clearly meant to be a learning experience so rolling something DIY is of course acceptable. Hard to estimate, maybe, but of course it would be hard to estimate something you don't know anything about and have never done before. Would a 4th grader be good at estimating how long it would take them to learn enough abstract algebra to start publishing papers on it?

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

#57
post #30

Earlier quoted context omitted.

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...

Thinking about it, v4 addresses and oil have a lot in common. The exhaustion/depletion is coming, but we keep finding ways to circumvent it. For oil you got fracking and sand. For v4 you see wider adoption of wide/carrier-grade NAT. In both cases it temporarily solves the supply problem really effectively. However it also ruins the environment.

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

#59
post #54

Earlier quoted context omitted.

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…

Essentially we enable in-browser comms (including but not limited to WebRTC for video and audio streams on top of storefronts). Given we allow anonymous connections, we need to associate each WebRTC connection with user defined data (read user profile). It's not quite as simple as "a cookie" because one user can have multiple devices, updated user information has to sync across the other connections and for a smooth…

What do you mean by anonymous connections? Without them being logged in and you actively tracking them, it is anonymous. You'd be reinventing the wheel to de-anonymize the user if you want to track users across devices, which is certainly not anonymous: existing companies use advertising IDs or cookies, based on the problem. There is no way you can identify users across devices devices (or solve this problem better) than Google and Facebook, since you run in 1 application, they run in almost all of them.

"We did look at syncing all this with RTC data channels,", that's when you use a reliable service with additional functionality like history and presence, not WebRTC data channels, that might be why you struggled. It sounds like you should be using WebSockets for this type of data.

It sounds like you're trying to build chat for ecommerce websites, but isn't that Intercom, tidio.com (free tier alternative). Agora is lower level, but also solves these problems and more: messaging, audio, video calls. I don't think any of these offer cross device identification without having users log in on all their devices.

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

#60

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…

I really like the video doorbell project, can you make it OSS and put it on a Github repo?
Post reply on HN