O'Reilly logo

Socket.IO Cookbook by Tyson Cadenhead

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required