Responding to tap events from the device

One cool thing about having a central server-side location to emit events from using Socket.IO is that you can use it as an API for multiple applications.

In this recipe, we will emit events to the server every time a user taps on a button on our app. The server will then emit the tap data to the client side, where it will be displayed on an analytics page.

This technique can be useful for gathering analytics data in real time, and watching the results of A/B testing as they happen.

How to do it…

To respond to tap events from the device by updating the counts on our analytics page, follow these steps:

  1. First, we will create our new Cordova app by running cordova create app com.client.tapsclientTaps.
  2. Next, we will ...

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.