What is the advantage of using event emitters in n

2019-08-20 08:29发布

问题:

I was going through this code to try and understand websockets.

Just to be clear I am not asking about sockets.io events emitters. Those I understand.

What I do not understand is the advantage of using nodejs eventEmitters, as used here. My question is why not just call a function from that line instead of using an event emitter? Is there any advantage of using the event emitter?