Here i cannot understand what is the basic difference between these two methods.
var events = require(\'events\');
var eventEmitter = new events.EventEmitter
.on() is exactly the same as .addListener() in the EventEmitter object.
Straight from the EventEmitter source code:
EventEmitter.prototype.on = EventEmitter.prototype.addListener;
Sleuthing through the GitHub repository, there is this checkin from Jul 3, 2010 that contains the comment: "Experimental: 'on' as alias to 'addListener'".
Update in 2017: The documentation for EventEmitter.prototype.addListener() now says this:
Alias for
emitter.on(eventName, listener).