Every object in Node.js capable of emitting events is a member of the EventEmitter
class. The http
module is one such example.
All EventEmitter
classes can use the eventEmitter.on()
function to attach event listeners to the event. Then, as soon as such an event is caught, its listeners are called one by one synchronously.