WebRTC Book
This page contains the detailed contents for the book "WebRTC: APIs and RTCWEB Protocols of the HTML5 Real-Time Web" Third Edition, March 2014.

TABLE OF CONTENTS

ACKNOWLEDGMENTS

PREFACE
PREFACE To Second Edition
PREFACE To First Edition

1 Introduction to Web Real-Time Communications
1.1 WebRTC Introduction
1.1.1 The Web Browsing Model
1.1.2 The Real-Time Communication Function in the Browser
1.1.3 Elements of a WebRTC System
1.1.4 The WebRTC Triangle
1.1.5 The WebRTC Trapezoid
1.1.6 WebRTC and the Session Initiation Protocol (SIP)
1.1.7 WebRTC and Jingle
1.1.8 WebRTC and the Public Switched Telephone Network (PSTN)
1.2 Multiple Media Streams in WebRTC
1.3 Multi-Party Sessions in WebRTC
1.4 WebRTC Standards
1.5 What is New in WebRTC
1.6 Important Terminology Notes
1.7 References

2 How to Use WebRTC
2.1 Setting Up a WebRTC Session
2.1.1 Obtaining Local Media
2.1.2 Setting up the Peer Connection
2.1.3 Exchanging Media or Data
2.1.4 Closing the Connection
2.2 WebRTC Networking and Interworking Examples
2.2.1 Session Establishment in WebRTC Triangle
2.2.2 Session Establishment in WebRTC Trapezoid
2.2.3 WebRTC Session Establishment with SIP Endpoint
2.2.4 WebRTC Session Establishment with Jingle Endpoint
2.2.5 WebRTC Session Establishment with PSTN
2.2.6 WebRTC Session Establishment with SIP and Media Gateway
2.3 WebRTC Pseudo-Code Example
2.3.1 Pseudo Code for Mobile Browser
2.3.2 Pseudo Code for Laptop Browser
2.4 References

3 Local Media
3.1 Media in WebRTC
3.1.1 Tracks
3.1.2 Streams
3.2 Capturing Local Media
3.3 Media Selection and Control
3.4 Media Streams Example
3.5 Local Media Runnable Code Example
3.5.1 Web Server
3.5.1.1 index.js
3.5.1.2 server.js
3.5.1.3 log.js
3.5.2 Client WebRTC Application

4 Signaling
4.1 The Role of Signaling
4.1.1 Why Signaling is Not Standardized
4.1.2 Media Negotiation
4.1.3 Identification and Authentication
4.1.4 Controlling the Media Session
4.1.5 Glare Resolution
4.2 Signaling Transport
4.2.1 HTTP Transport
4.2.2 WebSocket Transport
4.2.3 Data Channel Transport
4.3 Signaling Protocol
4.3.1 Signaling State Machine
4.3.2 Signaling Identity
4.3.3 HTTP Polling
4.3.4 WebSocket Proxy
4.3.5 Google App Engine Channel API
4.3.6 SIP over WebSockets
4.3.7 Jingle over WebSockets
4.3.8 Data Channel Proprietary Signaling
4.3.9 Data Channel Using an Overlay
4.4 Summary of Signaling Choices
4.5 Signaling Channel Runnable Code Example
4.5.1 Web Server
4.5.1.1 index.js
4.5.1.2 server.js
4.5.2 Signaling channel
4.5.2.1 serverXHRSignalingChannel.js
4.5.2.2 clientXHRSignalingChannel.js
4.5.3 Client WebRTC Application
4.6 References

5 Peer-to-Peer Media
5.1 WebRTC Media Flows
5.1.1 Media Flows without WebRTC
5.1.2 Media Flows with WebRTC
5.2 WebRTC and Network Address Translation (NAT)
5.2.1 Peer-to-Peer Media Flow through Multiple NATs
5.2.2 Peer-to-Peer Media Flow through a Common NAT
5.2.3 Private and Public Addresses
5.3 STUN Servers
5.4 TURN Servers
5.5 Candidates

6 Peer Connection and Offer/Answer Negotiation
6.1 Peer Connections
6.2 Offer/Answer Negotiation
6.3 JavaScript Offer/Answer Control
6.4 Runnable Code Example: Peer Connection and Offer/Answer Negotiation
6.4.1 Client WebRTC Application

7 Data Channel
7.1 Introduction to the Data Channel
7.2 Using Data Channels
7.3 Data Channel Runnable Code Example
7.3.1 Client WebRTC Application

8 W3C Documents
8.1 WebRTC API Reference
8.2 WEBRTC Recommendations
8.3 WEBRTC Drafts
8.3.1 "WebRTC 1.0: Real-time Communication Between Browsers"
8.3.2 "Media Capture and Streams"
8.3.3 "MediaStream Capture Scenarios"
8.4 Related Work
8.4.1 MediaStream Recording API Specification
8.4.2 Image Capture API
8.4.3 Futures
8.4.4 Media Privacy
8.4.5 MediaStream Inactivity
8.5 References

9 NAT and Firewall Traversal
9.1 Introduction to Hole Punching
9.1.1 Relayed Media Through TURN Server
9.2 Interactive Connectivity Establishment
9.2.1 Gather Candidate Transport Addresses
9.2.2 Exchange of Candidates
9.2.3 STUN Connectivity Checks
9.2.4 Choose Selected Pair and Begin Media
9.2.5 Keep-Alives
9.2.6 ICE Restart
9.3 WebRTC and Firewalls
9.3.1 WebRTC Firewall Traversal
9.4 References

10 Protocols
10.1 Protocols
10.1.1 Wireshark Notes
10.2 WebRTC Protocol Overview
10.2.1 HTTP (Hyper-Text Transport Protocol)
10.2.2 WebSocket Protocol
10.2.3 RTP (Real-time Transport Protocol) and SRTP (Secure RTP)
10.2.4 SDP (Session Description Protocol)
10.2.5 STUN (Session Traversal Utilities for NAT)
10.2.6 TURN (Traversal Using Relays around NAT)
10.2.7 ICE (Interactive Connectivity Establishment)
10.2.8 TLS (Transport Layer Security)
10.2.9 TCP (Transmission Control Protocol)
10.2.10 DTLS (Datagram TLS)
10.2.11 UDP (User Datagram Protocol)
10.2.12 SCTP (Stream Control Transport Protocol)
10.2.12.1 Transporting SCTP over DTLS
10.2.13 IP (Internet Protocol)
10.3 References

11 IETF Documents
11.1 Request For Comments
11.2 Internet-Drafts
11.3 RTCWEB Working Group Internet-Drafts
11.3.1 "Overview: Real Time Protocols for Brower-based Applications" [draft-ietf-rtcweb-overview]
11.3.2 "Web Real-Time Communication Use-cases and Requirements" [draft-ietf-rtcweb-use-cases-and-requirements]
11.3.3 "Web Real-Time Communication (WebRTC): Media Transport and Use of RTP" [draft-ietf-rtcweb-rtp-usage]
11.3.4 "RTCWEB Security Architecture" [draft-ietf-rtcweb-security-arch]
11.3.5 "Security Considerations for RTC-Web" [draft-ietf-rtcweb-security]
11.3.6 "RTCWeb Data Channels" [draft-ietf-rtcweb-data-channel]
11.3.7 "WebRTC Data Channel Establishment Protocol" [draft-ietf-rtcweb-data-protocol]
11.3.8 "JavaScript Session Establishment Protocol" [draft-ietf-rtcweb-jsep]
11.3.9 "WebRTC Audio Codec and Media Processing Requirements" [draft-ietf-rtcweb-audio]
11.3.10 "STUN Usage for Consent Freshness" [draft-ietf-rtcweb-stun-consent-freshness]
11.3.11 "Transports for RTCWEB" [draft-ietf-rtcweb-transports]
11.4 Individual Internet-Drafts
11.4.1 "IANA Registry for RTCWeb Media Constraints" [draft-burnett-rtcweb-constraints-registry]
11.4.2 "RTCWEB Considerations for NATs, Firewalls and HTTP proxies" [draft-hutton-rtcweb-nat-firewall-considerations]
11.4.3 "DSCP and other packet markings for RTCWeb QoS" [draft-dhesikan-tsvwg-rtcweb-qos]
11.4.4 "A Google Congestion Control for Real-Time Communication on the World Wide Web" [draft-alvestrand-rmcat-congestion]
11.5 RTCWEB Documents in Other Working Groups
11.5.1 "Trickle ICE: Incremental Provisioning of Candidates for the Interactive Connectivity Establishment (ICE) Protocol" [draft-ietf-mmusic-trickle-ice]
11.5.2 "Multiplexing Negotiation Using Session Description Protocol (SDP) Port Numbers" [draft-ietf-mmusic-sdp-bundle-negotiation]
11.5.3 "Cross Stream Identification in the Session Description Protocol" [draft-ietf-mmusic-msid]
11.5.4 "Multiple Media Types in an RTP Session" [draft-ietf-avtcore-multi-media-rtp-session]
11.5.5 "Multimedia Congestion Control: Circuit Breakers for Unicast RTP Sessions" [draft-ietf-avtcore-rtp-circuit-breakers]
11.5.6 "Support for Multiple Clock Rates in an RTP Session" [draft-ietf-avtext-multiple-clock-rates]
11.5.7 "Stream Control Transmission Protocol (SCTP)-Based Media Transport in the Session Description Protocol (SDP)" [draft-ietf-mmusic-sctp-sdp]
11.5.8 "Mechanisms for Media Source Selection in the Session Description Protocol (SDP)" [draft-lennox-mmusic-sdp-source-selection]
11.5.9 STUN and TURN Extensions in the TRAM Working Group
11.6 References

12 IETF Related RFC Documents
12.1 Real-time Transport Protocol
12.1.1 "RTP: A Transport Protocol for Real-Time Applications" [RFC3550]
12.1.2 "RTP Profile for Audio and Video Conferences" [RFC3551]
12.1.3 "The Secure Real-time Transport Protocol (SRTP)" [RFC3711]
12.1.4 "Extended Secure RTP Profile for RTCP-Based Feedback (RTP/SAVPF)" [RFC5124]
12.1.5 "Multiplexing RTP Data and Control Packets on a Single Port" [RFC5761]
12.1.6 "A Real-time Transport Protocol (RTP) Header Extension for Mixer-to-Client Audio Level Indication" [RFC6465]
12.1.7 "A Real-time Transport Protocol (RTP) Header Extension for Client-to-Mixer Audio Level Indication" [RFC6464]
12.1.8 "Rapid Synchronization of RTP Flows" [RFC6051]
12.1.9 "RTP Retransmission Payload Format" [RFC4588]
12.1.10 "Codec Control Messages in the RTP Audio-Visual Profile with Feedback RTP/AVPF" [RFC5104]
12.1.11 "TCP Friendly Rate Control (TFRC): Protocol Specification" [RFC5348]
12.1.12 "A General Mechanism for RTP Header Extensions" [RFC5285]
12.1.13 "Guidelines for the Use of Variable Bit Rate Audio with Secure RTP" [RFC6562]
12.1.14 "Support for Reduced-Size Real-Time Transport Control Protocol (RTCP): Opportunities and Consequences" [RFC5506]
12.1.15 "Encryption of Header Extensions in the Secure Real-Time Transport Protocol (SRTP)" [RFC6904]
12.1.16 "Guidelines for Choosing RTP Control Protocol (RTCP) Canonical Names (CNAMEs)" [RFC7022]
12.2 Session Description Protocol
12.2.1 "SDP: Session Description Protocol" [RFC4566]
12.2.2 WebRTC SDP Examples From Browsers
12.2.2.1 Session Between Chrome Windows and Firefox Mac
12.2.2.2 Session Between Chrome OS and Chrome Windows
12.2.3 "Session Description Protocol (SDP) Bandwidth Modifiers for RTP Control Protocol (RTCP) Bandwidth" [RFC3556]
12.2.4 "Source-Specific Media Attributes in the Session Description Protocol (SDP)" [RFC5576]
12.2.5 "Negotiation of Generic Image Attributes in SDP" [RFC6236]
12.3 NAT Traversal RFCs
12.3.1 "Interactive Connectivity Establishment (ICE): A Protocol for Network Address Translator (NAT) Traversal for Offer/Answer Protocols" [RFC5245]
12.3.2 "Symmetric RTP / RTP Control Protocol (RTCP)" [RFC4961]
12.4 Codecs
12.4.1 "Definition of the Opus Audio Codec" [RFC6716]
12.4.2 "VP8 Data Format and Decoding Guide" [RFC6386]
12.5 Signaling
12.5.1 "The WebSocket Protocol as a Transport for the Session Initiation Protocol (SIP)" [RFC7118]
12.6 References

13 Security and Privacy
13.1 Browser Security Model
13.1.1 WebRTC Permissions
13.1.2 Web Site Identity
13.1.3 Browser User Identity
13.2 New WebRTC Browser Attacks
13.2.1 API Attacks
13.2.2 Protocol Attacks
13.2.3 Signaling Channel Attacks
13.3 Communication Security
13.3.1 Communication Privacy
13.3.2 Key Transport over the Signaling Channel
13.3.3 Key Agreement in the Media Path
13.3.4 Authentication
13.3.5 Identity
13.4 Identity in WebRTC
13.5 Enterprise Issues
13.6 Privacy
13.6.1 Identity Privacy
13.6.2 IP Address Privacy
13.6.3 Browser Fingerprinting
13.7 ZRTP over Data Channel
13.8 Summary
13.9 References

14 Implementations and Uses
14.1 Browsers
14.1.1 Apple Safari
14.1.2 Google Chrome
14.1.3 Mozilla Firefox
14.1.4 Microsoft Internet Explorer
14.1.5 Opera
14.2 Other Use Cases
14.3 STUN and TURN Server Implementations
14.4 References

Appendix A - The W3C Standards Process
A.1 Introduction to the World Wide Web Consortium
A.2 The W3C WEBRTC Working Group
A.3 How WEBRTC relates to other W3C Working Groups
A.4 References

Appendix B - The IETF Standards Process
B.1 Introduction to the Internet Engineering Task Force
B.2 The IETF RTCWEB Working Group
B.3 How RTCWEB relates to other IETF Working Groups
B.4 References

Appendix C - Glossary

Appendix D - Supplementary Reading and Sources

INDEX

ABOUT THE AUTHORS