WebRTC vs. WebSocket
Two ways to communicate with the server, what do they represent and what is the difference?
WebRTC allows real-time communication between the browser and the server and between browsers. RTC means Real-Time Communication. The Web API that allows for use in an application is the subject of a W3C standard that describes the interface of the objects involved in such communication.
It is clear that Microsoft wants to invest in this sort of technology (based on its recruitment) and that it will be incorporated into Skype, the free telephone service by computer, which is also the case of Google Talk. Microsoft has not implemented WebRTC under the pretext that the VP8 codec it uses could incorporate patents. A recent agreement (March 2013) with MPEG LA has suppressed this obstacle.
WebRTC is supported by Google and therefore uses the VP8 codec for videos. Google asks that this codec will become the standard for WebRTC and Opus codec will become the standard for audio. Both are patent-free. They are already used by Skype among other codecs.
Difference with WebSocket
WebSocket, which is also defined by the IETF and W3C is a protocol for bidirectional communication between the server and the browser. The W3C standard describes the API for use in an application.
WebRTC is a bidirectional real-time protocol for images and sound, between browsers, or servers.
WebRTC actually describes two APIs, one is the Web API which is described by the W3C standard, is all in what are interested webmasters. The other API in C++ that allows you to connect to multimedia services in backend, is used by the makers of browsers and other software.
Here is the diagram of the different layers of the WebRTC interface:
The Web API of WebRTC is a replacement for Ajax like WebSocket replaces the XMLHttpRequest object in the browser. There is however a whole new level with a two-way access in real time, without waiting for the server. It is still necessary that it can support such a charge, which is why this system is intended rather to run an application on a dedicated server. But the ability to let remote browsers communicate offer new possibilities for creators of applications.
Documents and code
- WebSocket vs. XMLHttpRequest.
- Source code. For your server.
- Example of WebRTC application.
- CU-RTC-Web (Customizable, Ubiquitous Real Time Communication over the Web) was an alternative to WebRTC proposed by Microsoft. It is independent of any codec.
- ORTC-node. Implementation of the API on Node.js, so to let communicate local stations or a local computer with the browser.