React Native Video Calling App – Part 6

Welcome to the tutorial React Native Video Calling App Part 6. In this part of tutorial we will check if the user is busy and not allow any call if busy.

Below is updated code of client side :

In the above code,  we have added a message of type “call_busy” in the onAnswer function. So, when user receives the call and busy variable is set to true then a message will be sent back to server ( of type “call_busy”). Also, in the switch case of onResponse function we have added a ‘busy’ case. So if we make a call to a user and that user is busy then server will reply us back with a busy message and our busy variable will be se to false and incallwith variable will be set to empty string.

Now, lets have a look of our updated code on server side :

In the above code we have added a switch case ‘call_busy’. So, when a user makes call to another user and his call is busy, then the user will send message of type call busy to the server and server will send message of type ‘call_response’ with response property set to ‘busy’. This will notify calling user that the user to whom he is calling is busy.

So, now our app can detect if a user is busy or available for call. In next part of tutorial we will install WebRTC package to our video calling app.  Subscribe to our newsletter and stay tuned to everything happening in react native world.

Video Tutorial