I'm writing a nodejs based rest API.
My API have different methods like put /friends that adds a user to friend list of the currently logged in user.
I want to notify the other user, that he has been added as a friend, via different methods (push notification, mail, whatever). I dont want to do the notification inside the API process, instead I want to publish an events that another nodejs process (might be even running on a different machine), will pickup and do the notification work.
What are the accepted methods to implement such architecture? The key here is that I want pub/sub pattern between different nodejs processes that might not even share the same machine, so I guess regular EventEmitter wont help there.
Thanks for help!