I'm working on a prototype which uses SignalR for broadcasting messages from the server to clients. I also communicate from clients to the server. This is possible via 2 ways: via controllers or via a method call in the SignalR Hub.
Now my question:
Why would I choose either SignalR Hub Methods or the ASP.NET API Controllers as endpoints for client commands to call? (so not for events / broadcasting messages)
And to follow up: Is it recommended to use one or both?
I read that it's not recommended to call the Hub methods from the API Controllers, because they're for the clients to call, not for the server.
Both API Controller and SignalR Hub use HTTP.
I've used:
- ASP.NET Core SignalR 1.1.0
- Latest .NET Core version
And following link for SignalR information:
https://docs.microsoft.com/en-us/aspnet/core/signalr/introduction?view=aspnetcore-5.0