19 lessons
The Certificate
When you need access to constantly refreshed information, for example, notification every time data is available, callbacks won’t be able to handle that as efficiently as Event Emitter. The standard interface separates an emitter (a single event emitter) and event listeners (more than one, depending on the complexity of your program).
We’ve already defined event emitters, as for event listeners - they are attached to the event emitter and listen to ongoing requests.
In the above-displayed code snippet, you can trace the steps required to make an HTTP request to an HTTP server with Node’s http.request API. The http.request method initiates the callback that emits the data and end events. The result here is a newly registered callback function that will be initiated any time the data and end events take place.