I’m working on a project where I have a backend API done on NetCore which provides several endpoints (regular, using controllers), which is secured by using Azure Entra authentication, this work in conjunction with an Angular client.
Now, I want to add SignalR to the mix so we can handle real time updates to a notification system on the client side, which should update each time a new notification is triggered. This could be triggered by any action of the Controllers, or even by other applications running on same environment (we’re using Azure for hosting).
So my initial idea was to have a separate application running just to host the Hub and expose an RPC which would then notify each connected client that a new notification has been created. I thought about doing it this way mainly because I don’t want the main backend API being bottlenecked by the multiple connection the signalR Hub could have opened at the same time, both by the Sockets and the threads it can be consuming in any given time, but to be honest I’m pretty new to SignalR and not sure if that could really be a problem, this is no chat app and I don’t think we’ll ever have more than 100 people using the application.
Having that in mind I’m considering adding the Hub directly to the main Backend API, which would also (I think) let me reuse the Auth logic already implemented there, without having to do additional configuration for the Hub to have security and only let authenticated users be able to connect and interact with the hub.
My main concern is still the resource management impact the second option could have on the whole Backend API, what do you think is a better approach? Also, what would be the best approach concerning Authentication being that we use Azure Entra?