Book Image

WebRTC Blueprints

By : Andrii Sergiienko
Book Image

WebRTC Blueprints

By: Andrii Sergiienko

Overview of this book

Table of Contents (13 chapters)
WebRTC Blueprints
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Using the TURN authentication


From Chapter 1, Developing a WebRTC Application, you know that we used such a construction to get a new peer connection object:

var pc = RTCPeerConnection(pc_config, pc_constraints);

The pc_config parameter in the preceding code is a set of configuration options that we want to use while creating the peer connection object.

In the previous chapter, we used only the STUN technology, and usually, pc_config was something similar to the following:

var pc_config = {"iceServers":
       [{url:'stun:23.21.150.121'},
        {url:'stun:stun.l.google.com:19302'}]};

Here, you can see the two URLs of the ICE servers (we also discussed the ICE framework in Chapter 1, Developing a WebRTC Application), and they are both STUN servers.

In the same way, we can refer to a TURN server as follows:

{
  'iceServers': [
    {
      'url': 'stun:stun.l.google.com:19302'
    },
    {
      'url': 'turn:turn1.myserver.com:12345?transport=udp',
      'credential': 'UGJKBJHVYT',
      'username...