I have node.js server, and clients connecting by AJAX HTTP long polling request. I want to create one EventEmitter object and I want to add every new client to this object after received request from him. What is proper way to do this? In other words: How use "emitter.on(event, listener)" in function runs for every client to have them all waiting in EventEmitter listeners array?
Asked
Active
Viewed 1,857 times
1 Answers
2
It's probably easier to have just one event emitter listener and have an array of waiting long polling requests. Then, you are free to add/remove items from the array at any time as connections come and go and there's just one listener that processes whatever requests are in the array when an event occurs.

jfriend00
- 683,504
- 96
- 985
- 979