Running server on mobile

Till now we were working on a local server and application, but to run the application on a mobile, we need to shift our client application code to a server in such a way that it will cater to the application from a server URL. For this we will take a simple example: basically, we are going to change an application we have already created. In Chapter 2, Getting Started with WebSockets, we developed an application for Echo test, which basically returns whatever we send to the server. Now let's see how it will work on a mobile phone.

Firstly, we will change the server code so that it caters to the client code. Here are the changes we will make on the server side:

var express = require('express'); var app = express() var http ...

Get WebSocket Essentials – Building Apps with HTML5 WebSockets now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.