we’re creating our first SignalR dedicated .net API.
So we’re basically beginners on this matter 😉
The way I see it, we’ll use it in two distinct ways :
- Message sent from a Web/Mobile client application and received by another Web/Mobile client application
- Message sent from an API (not our SignalR API) and received by a Web/Mobile client application
The first one seems to be the normal usage of SignalR.
The second one is a little bit more tricky.
The example that is shown in Microsoft Documentation involves dependencies between our APIs and the SignalR API, because its url must be provided.
Like this :
using (var hubConnection = new HubConnection("http://www.contoso.com/"))
{
IHubProxy stockTickerHubProxy = hubConnection.CreateHubProxy("StockTickerHub");
stockTickerHubProxy.On<Stock>("UpdateStockPrice", stock => Console.WriteLine("Stock update for {0} new price {1}", stock.Symbol, stock.Price));
await hubConnection.Start();
}
I don’t like this kind of dependencies. The only one we have is with Identity Server, and caused us a lot of issues !
It could probably be achieved through service bus, but we don’t have any for the moment.
So I was thinking : is there a way to dispatch such messages through a database ?
I mean : the source API don’t need a real maintained long term connection.
All it needs is to put the message somewhere and move on (it’s just an event that happened, a notification, not a discussion)
Does anything like this exist already (nuget package) ?
Or is there a built in way to avoid this cross api call that I’ve missed ?
Thanks in advance for your help.
As previously mentioned, all this is new to us.
8