W3cubDocs

/Web APIs

Building an Internet-Connected Phone with PeerJS

One of WebRTC's main issues is that it is pretty complicated to use and develop with — handling the signalling service and knowing when to call the right endpoint can get confusing. But there is some good news; PeerJS is a WebRTC framework that abstracts away all of the ice and signalling logic so that you can focus on the functionality of your application. There are two parts to PeerJS, the client-side framework and the server.

In this series of articles we will create a simple phone application using PeerJS. We'll be using both the server and the client-side framework, but most of our work will be involved with handling the client-side code.

Prerequisites

This is an intermediate level tutorial; before attempting it you should already be comfortable with:

Before you get started, you'll want to make sure you've installed node and Yarn (the instructions in later articles assume Yarn, but you can feel free to use npm or another manager if you'd prefer).

Note: If you learn better by following step-by-step code, we've also provided this tutorial in code, which you can use instead.

Table of Contents

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/Build_a_phone_with_peerjs