WebRTC vs WebSockets: What are the differences? — Ant Media Server

  • WebRTC sends data directly across browsers — it is called “P2P”
  • It can send audio, video, or data in real-time
  • It needs to use NAT traversal mechanisms for browsers to reach each other
  • P2P needs to be gone through a relay server (TURN)
  • With WebRTC you need to think about signaling and media. They are different from each other.
  • One of the main features of the tech was that it allowed peer-to-peer (browser-to-browser) communication with little intervention of a server, which is usually used only for signaling.
  • It’s possible to hold video calls with multiple participants using peer-to-peer communication. Media server helps reduce the number of streams a client needs to send, usually to one, and can even reduce the number of streams a client needs to receive.
  • Servers you’ll need in a WebRTC product:
  • Signaling server
  • STUN/TURN servers
  • Media servers (It is up to your use case

Does WebRTC use WebSockets?

You don’t have to use WebSockets in your WebRTC application. As I mentioned above WebRTC needs a transport protocol to open a WebRTC peer connection. WebSockets are widely used for this purpose. Hence, from this point of view, WebSocket is not a replacement for WebRTC, it is complimentary. That’s why WebRTC vs Websocket search is not the right term.

--

--

Ant Media Server, open source software, supports publishing live streams with WebRTC and RTMP. It supports HLS(HTTP Live Streaming) and MP4 as well.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ant Media Server

Ant Media Server

Ant Media Server, open source software, supports publishing live streams with WebRTC and RTMP. It supports HLS(HTTP Live Streaming) and MP4 as well.