Practical WebRTC deployment

Although the WebRTC API does not provide a signalling protocol, as described in the section called “Signalling protocols”, this does not mean that deployers need to think about developing something themself. In practice, there are several JavaScript libraries which combine a complete signalling implementation and WebRTC API interaction, giving the web developer a very simple API to start and stop calls.

WebRTC clients and firewalls

Any type of RTC project faces two major problems engaging users: ensuring that users have suitable software and ensuring that there is a suitable network connection. WebRTC comprehensively addresses the first problem, ensuring that users have suitable software, by deploying the software as part of the web browser. This solution is so effective because of the high percentage of users who have web browsers and the vast majority of them are receiving automatic upgrades to the latest version of the browser. The latter problem, ensuring a suitable network connection, is more complicated.

The second problem, network connectivity, is explained in the section called “Getting through firewalls”. The comments in that section are especially relevant to WebRTC. WebRTC clients are particularly well suited to work through these problems because of their native support for ICE, TURN, TLS and HTTP proxy servers.

JsSIP and JSCommunicator

For those interested in using SIP for WebRTC signalling, the most compelling solution now involves a combination of JsSIP and JSCommunicator. JsSIP provides the low-level support for SIP message parsing. JSCommunicator provides a high-level API and even a fragment of HTML that can be embedded into an existing page to get up and running quickly.

JSCommunicator works with a repro SIP proxy server configured using the settings in Example 11.3, “Sample values for repro.config.

To deploy JSCommunicator, take a copy of the HTML, CSS and JavaScript from an existing web site or from the Github repository. If using the code from Github, it is necessary to download each dependency and then run the script to combine and minify the JavaScript code (see the README file). Make any necessary changes to the config.js file and embed the jscommunicator.inc HTML fragment into an existing page template.

Content Management Systems and other frameworks

Search the plugin or module catalog for any major Content Management System (CMS) and you will find many plugins claiming to offer WebRTC. A large number of these are either promoting browser plugins or promoting proprietary services that do not use open standards and lock you into using a specific back-end. Look for those that offer full source code and support for one of the documented and widely supported signalling protocols, SIP or XMPP, so you will have a free choice to run any of the servers described in this guide or use of any arbitrary provider.

For Drupal web sites, adding WebRTC is as simple as adding the DruCall module and pointing it to a SIP proxy such as repro.

The DruCall module is based on JSCommunicator so it also provides a very good example of how to adapt JSCommunicator to other CMS platforms.

Figure 13.1. DruCall/JSCommunicator/JsSIP software stack


Figure 13.1, “DruCall/JSCommunicator/JsSIP software stack” demonstrates the relationship between the JavaScript libraries used in DruCall and the underlying web browser APIs.

Troubleshooting

See the section called “WebRTC and WebSockets”.