Lookin for some advice on how to loosely couple SignalR hub with rest of my application, maybe some sanity check?
Right now 2 things come to my mind:
1. Make a service encapsulating SignalR stuff and use its interface to expose in the rest of my application. This solves issue of bi-directional coupling since i can expose methods that talk to connections by connection Id and events that fire when connection sends something.
2. Use MediatR to facilitate bi-directional communication. This has the added benefit of tidying things up but has some drawbacks:
1. I can't find neat way to use Rx stuff to do things such as throttling
2. I now have bi-directional dependency on mediator and request handlers
3. Still didn't figure out a way to package IHub somewhere
Is there a third way? What do you guys think/do?