| PeerJS does wrong by forcing opening data channels for you, it's already forcing you into a specific opinion on how it should work. Also, it doesn't work in Node.js. I understand their API idea but it should have been one level lower first, to build on top. like-webrtc gives you the RTCPeerConnection perfectly negotiated, connected, cross-platform (browsers, Node, React Native), etc but nothing else then you can open a data channel the way you want. Imagine a TCP or HTTP server/client API, this is the same but you get a peer connection with no extra assumptions and it's up to you what you do next. WebRTC in servers is also important, e.g. imagine long-running bots or literally just run your backend using WebRTC lol. - TCP (congested) + HTTPS (insecure centralized global CA) + JSON (slow)
versus
- UDP (low latency) + RPC (request/response) + binary encoding (fast) We should start running our centralized backends with WebRTC as a first step to adopt and improve tooling around WebRTC. That's why I compiled and released a modern WebRTC build version for Node.js: https://github.com/LuKks/webrtc-runtime (no signaling, no features, etc) That allows you to use RTCPeerConnection cross-platform anywhere, so I used webrtc-runtime to build like-webrtc (complete solution). |