A complete WebRTC client

The following is the entire JavaScript code used in our client application. This includes all the code to hook up the UI, connect to the signaling server, and initiate a WebRTC connection with another user:

var connection = new WebSocket('ws://localhost:8888'), name = ""; var loginPage = document.querySelector('#login-page'), usernameInput = document.querySelector('#username'), loginButton = document.querySelector('#login'), callPage = document.querySelector('#call-page'), theirUsernameInput = document.querySelector('#their- username'), callButton = document.querySelector('#call'), hangUpButton = document.querySelector('#hang-up'); callPage.style.display = "none"; // Login when the user clicks the button loginButton.addEventListener("click", ...

Get Learning WebRTC now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.