3 ms·
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 negot
by ejb503 5y ago
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 signature is probably needed too!!
(We've just spent a year building this for ecommerce @ https://yown.it https://yown.it)
BIG thumbs up for the interest in WebRTC though enormous potential...
- throw14082020 5y agoWebRTC 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 negotiation), and there are many providers that will help with that (ably.com, pubnub.com, pusher.com), you don't need to build your own infrastructure. WebSockets is also just one option. Using a SFU/ MCU is almost a requirement for multi person calls, becoming more important for bigger groups. I had a look at yown.it, I don't know what it does, your description of it is a bit vague. Those problems you mention are not hard to solve: "device signature"? You just set a cookie. Connection dropped? Cookie got you covered. New tab? Cookie got you covered. Refresh? Cookie you got covered. Other interesting technologies are: Twilio's network traversal service: https://www.twilio.com/stun-turn https://www.twilio.com/stun-turn Agora's higher level products (e.g. video call, voice call) https://www.agora.io/en https://www.agora.io/en
- socceroos 5y agoAnother great alternative: https://jitsi.org/projects/ https://jitsi.org/projects/
- ejb503 5y agoEssentially 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".
- throw14082020 5y agoWhat 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.
- ejb503 5y agohttps://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/Perfect_negotiation 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".