O'Reilly logo

Creating Mobile Apps with Appcelerator Titanium by Christian Brousseau

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

Coding our game server

Now that our Node.js server is properly installed and our socket.io module is configured on both the server and the client, we can finally start coding. We will first go over the server code, cover all the games' interactions, and then move onto the client side and interact with the said server.

Creating a web server in less than 10 lines of code

One of the great things about Node.js is that it uses the familiar JavaScript language. It also provides us with a very powerful set of APIs to achieve our goals. We will start by creating our web server in order for our players to connect to it.

First, we will create a new file named app.js in our server project. Inside this file, we will code our entire game server. First we will ...

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