First, install socket.io module in node.js application.
npm install socket.io --save
Basic HTTP Setup
The following example attaches socket.io to a plain node.js HTTP server listening on port 3000.
var server = require('http').createServer();
var io = require('socket.io')(server);
io.on(...