|
|
|
|
|
by bencord0
4185 days ago
|
|
WebSockets and WebRTC are two very different protocols and have very different use cases. WebSockets is an extension to a HTTP request that permits a bi-directional, persistent link between a client and server.
You can exchange chunked messages, reliably and in-order using TCP. Once the WebSocket is established, you have free reign over what datastream is sent. WebRTC is an extension of RTP (a UDP based protocol) that adds a layer of safety (to both users and to network infrastructure).
The key requirement for "real-time" communications mandates that reliable and in-order delivery must be sacrificed in favour of getting low-latency data transfers. Another benefit of WebRTC is that browser-side javascript has no control over the exact datagram being sent over the wire (called RTCWeb, all WebRTC communication is encrypted between peers using SRTP). This eliminates a whole class of UDP based attacks. The client (or intermediate proxies) must not be able to send a specially crafted UDP packet to arbitrary hosts and trigger a distributed reflection attack. Having said that, WebRTC can be used to transport arbitrary data, you just can't send an arbitrary packet. |
|