Throwing an alert when the socket connects

Apache Cordova is a platform for building native mobile applications using HTML, CSS, and JavaScript. It basically wraps your entire application in a web view and exposes certain native events to the application through JavaScript.

In this recipe, we will emit a message from the server using Socket.IO when the application first opens.

Getting ready

For this recipe, you will need to use a Mac. The reason for this is that Cordova will create an app that runs using XCode, which is only available for the Macintosh operating system.

How to do it…

To throw an alert in a Cordova app when the socket connects, follow these steps:

  1. First, we need to install Cordova. There is a command-line interface that can be installed ...

Get Socket.IO Cookbook 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.