Realtime Chat Application with CakePHP and Socket.IO #3

In this tutoriel we are going to setup the nodejs server to recive socket.io events.



First make sure that nodejs is correctly installed on your server in my case it was Debian Server


Create a folder in your server and with commande line (pointed to this folder ) type

npm init

this create a file called package.json  we need this file to install ou node module



to install just type npm install


Modules

Socket.IO : to be able to use realtime events in our application
Node-mysql : to connect to mysql database
nodemon :  this just dev dependency to restart the server when make (server side) changes





we need to create another important file whitch is server.js this is the main server code


in this file we are setup a nodejs / socket.io server and listen to it in port 3000

the server point to index.php file but you can point it to empty html file , it's not a problem

NB: it's just requiring module , installed / or nativly included in nodejs like http

to test server just type node server.js or nodemon server.js 

Comments

  1. I am no expert. But I believe you just made an excellent point. You certainly fully understand what you are speaking about. and I can truly get behind that.
    anti captcha api

    ReplyDelete

Post a Comment

Popular posts from this blog

Twitter API with PHP

Realtime Chat Application with CakePHP and Socket.IO #1

Let's build a mobile application with Ionic Framework #3