Socket.IO

Socket.IO

Connect

 

var io = require(‘socket.io’).listen(80);

io.sockets.on(‘connection’, function (socket) {

socket.on(‘message’, function (data) {
console.log(data);
});
});

  • on message need to parse
  • and on send stringify.

Managing Log Level

 

io.set(‘log level’, 1);

Maintaining connection of same user with socket.io in multiple tab of Browser

 

  • use the same port for both node.js and socket.io server by passing server to listen method of socket.io

References

http://www.danielbaulig.de/socket-ioexpress/
http://stackoverflow.com/questions/8567015/how-to-handle-user-and-socket-pairs-with-node-js-redis

References

Advertisements

About rahul23134654

Hi, I am Rahul Meha , B.E. in (I.T.)
This entry was posted in Node.js. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s