Use a free signalling server from the webtorrent community. You can skip the torrent part of the implementation and just use the signalling, it's awesome. You can use a libraries like:
https://github.com/webtorrent/bittorrent-tracker
https://github.com/subins2000/p2pt
to get started. For me, I found the protocol is simple enough where I just use small vanilla javascipt implementation to talk to the websocket servers to generate the signalling messages. I wish more people knew about this and realize how easy it can be to bring WebRTC to their applications.
List of some free webtorrent trackers:
wss://tracker.openwebtorrent.com
wss://tracker.files.fm:7073
wss://tracker.webtorrent.dev
---> Usage stats for the last one: https://tracker.webtorrent.devSome free stun servers for NAT traversal:
stun:stun.cloudflare.com
stun:stun.l.google.com:19302https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/...
scroll down a bit for the STUNless/TURNless bit
It abstracts away the work of signaling and connects peers via open decentralized networks like BitTorrent, Nostr, MQTT, IPFS, etc.
The problems this solves look interesting for a few CLI tools I want to build :)
This could be possible browser to browser! I don’t think that has ever been an official use case
It's a super nice architecture
Theoretically they could get the camera itself do auth, and then the server becomes fully 'dumb', and need not even be service specific.
Via cloud when necessary, "local" (by WebRTC) when possible. While we could just open a local port, using the cloud to arbitrate gives us a common product vision, and proper authN/authZ.
Also allows us to pull the latency down to single digit milliseconds. The regional relays are double digit. When we use relays that aren't regional it's a couple hundred.
(And yes, I do this. Works great.)
You need to trust the signalling server though.
This library seems to do a few other things, which maybe reduces the trust in the signalling server, but I didn’t really read it in enough detail to comment on it.
The TURN server can see the size/src/dst so that has a privacy implication!
Looks like it's using PeerJS, which defaults to a config of using a Google STUN server and no TURN servers. Not sure if using a STUN server compromises the E2E in some way?
There were great recommendations in this thread tho, thanks a lot! This one looks good: https://github.com/subins2000/p2pt
There are already more than enough tools that can record HLS and Dash, but I haven't find anything, not even PoC that can record video streams transited via WebRTC (e.g. agora.io).
Although, an alternative is something like Tailscale.