My need is to generate custom events in router, that shall be based on the data that is coming from front-end. Like if the front-end object has handle_hello_world
, then the router shall emit an event for handle_hello_world
, so that the corresponding event listener can wake up and handle the request. The callback from this listener should again go back to router and then back to the front-end.
I tried my hands with normal events emitters in node.js that would emit and receive events within the same scoped file. But I failed to do the desired linkage from router -> handler -> router again.
Any help with events, streams, bacon, event bus, publisher-subscriber, socket.io, etc. would be handy as my knowledge in node events is not great.