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 asked 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.
In November 2014, the RTCWEB working group decided that VP8 and H264 are both mandatory in WebRTC. The browsers will have to implement both 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.

In both cases there is an interface used by webmasters in JavaScript, and a communication protocol that is used internally by the authors of browsers. The second protocol can be used by the former.
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:

WebRTC

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.

Object RTC

In October 2014, Microsoft announced that Internet Explorer would support ORTC. This is an extensive JavaScript API based on RTC. It was a difficult decision for Microsoft, because as soon the browser provides the ability to communicate vocally and visually, this make services like Skype useless (Microsoft bought it in 2011 for $ 8.5 billion), or at least facilitates the creation of competitors, but it is needed to keep up with Firefox and Chrome.

Documents and code