Vitamin C Listen to Events

Listening to internal and custom events:

Server Syntax

var io = require('')(80);

io.on('connection', function (mysocket) {

  //custom event called `private message`
  mysocket.on('private message', function (from, msg) {
    console.log('I received a private message by ', from, ' saying ', msg);

  //internal `disconnect` event fired, when a socket disconnects
  mysocket.on('disconnect', function () {
    console.log('user disconnected');

Client syntax:

var mysocket = io('');
  mysocket.on('private message', function (data) {

Got any Question?