Connecting to the Signaling Channel

There are a few preliminary steps you’ll need to take to connect to the signaling channel. The first is to return to the index.html file and add another <script> tag right above the one that loads the main.js file. Point it to the JavaScript file /socket.io/socket.io.js that Socket.IO automatically serves:

»<script src=​"/socket.io/socket.io.js"​></script>
 <script src=​"js/main.js"​></script>
 </body>
 </html>

The main.js file depends on the contents of the socket.io.js file, which is the Socket.IO client, so be sure to include the <script> tag that points at main.js second in the HTML.

Back in the main.js file itself, in the “Signaling-Channel Setup” area up top, let’s connect to ...

Get Programming WebRTC now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.