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:
First, we need to install Cordova. There is a command-line interface that can be installed by running
npm install cordova –g
in your terminal.Next, we need to create a new application using the Cordova command-line interface that we just installed. Cordova can be run with
cordova create app com.throw.alertThrowAlert
. The first argument...