Initiating a call

From here on, our code does not get any more complex than the login handler. We will create a set of handlers to pass our message correctly for each step of the way. One of the first calls that is made after logging in is the offer handler, which designates that one user would like to call another.

It is a good idea not to get call initiations mixed up with the offer step of WebRTC. In this example, we have combined the two to make our API easier to work with. In most settings, these steps will be separated. This can be seen in an application, such as Skype, where the other user has to accept the incoming call before a connection is established between the two users.

We can now add the offer handler into this code:

case ""offer"": ...

Get Learning 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.