I'm new to SignalR and have some questions about using it correctly in certain scenarios
For my application I'm using signalR to communicate to a client the status of an operation they submitted, while they wait for the final response. My code is structured as such:
- User click a button in UI
- A connection established between the client and the hub
- A call is made to our Web Api
- The Web Api makes a call to logic on our service layer
- The service layer processes data through a foreach.
- For each iteration, the hub send out a signal containing data update a progress bar in the UI
I've been able to achieve all this. But I had to setup a new type using GetHubContext to be able to call my signal method, because I can't work with the Hub object directly. Doing this doesn't allow me to send the signal a specific user because it's not known to the service layer, I'm only able to broadcast to all.
What pattern should I be using to achieve this? For my current setup it seems I would need to setup incoming connections with a group equal to their connectionId, communicate the connectionId to the various layers, and send a signal to that specific "group" as needed. Is this the best setup?