Doing server-side pagination

When you have a large amount of data, it is often beneficial to present it in paged format so that you don't have to load all of it at once. In this recipe, we will create an app with several pages of data that will require server-side pagination.

Getting ready

For this recipe, we will use a library called Chance to generate a large set of random data. Chance is composed of various functions that allow us to get all sorts of random data to test with. So, it is ideal to mock up data before you have any. It can be installed by running npm install chance in your command line.

How to do it…

To do server-side pagination using Socket.IO, follow these steps:

  1. First, we will create our new Cordova app by running cordova create app ...

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.