HTML5 WebSocket vs WebRTC

Abdul Wadud Chowdhury
Oceanize Lab Geeks
Published in
2 min readJan 29, 2018

WebRTC (Web Real-Time Communication) — Is peer-to-peer type of transport and is transport-agnostic so uses UDP, TCP, SCTP or even more abstract layers. It allows to transport data in reliable as well as unreliable ways. It is generally used for high volume data transfer, such as video/audio streaming where reliability — is secondary and few frames or reduction in quality progression can be sacrificed in favor of response time and at least delivering something. Both sides (peers) can push data to each other independently, so it’s not use server that much.

While it can be used totally independent from any centralized servers it still requires some way of exchanging endpoints data, where in most cases developers still use centralized servers to “link” between the peers. This is required only to exchange essential data for connection establishing — after connection is established server on aside is not required. It will be better for situation like,

when there is no intense to monitor or store the communication data.

Also it support less browser then websocket.

WebSocket — It create TCP connection to server, and keep is as long as needed. A web socket server can handle multiple client. Client can leave the socket at any time. Server has right to close any connection.

It’s Bidirectional communication — so server and client can exchange data both directions at any time. It is very efficient if application requires frequent messages, such as it can be used for notification system. It do data framing that includes masking for each message sent from client to server so data is simply encrypted.

--

--