I had been struggling with this issue myself. I really need a socket service that I can access from any page and be able to both send and receive socket.io events.
After lots of research, I decided to use the Observable pattern. And here is what I came up with:
Here is the article that helped me really understand Observable and its event handling capaciblities:
The way the SocketService works is, first it creates an observable instance, and call its next() function on any event that the clients should know about. Then you can inject SocketService into any page and call the subscribe method to be notified of events.
My solution is by no means the best way to do it. If anyone finds a better way, I’d love to hear your solution.