So I created a service bus queue and the client puts message in this queue and the bus listener gets it and does the work.All this is written in asp.net C#. What i want to do is notify the client when the work is done and for this I want to use signalR. But the signalR clients are usually written in javascript. How can I do this. Use signalr and the bus service queue
SignalR also has a .Net client , so it will fit into your asp.net technology stack SignalR .Net client , You will first need to establish connection :
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();
and create a client side function the server can use :
stockTickerHub.On("notify", () =>
// Context is a reference to SynchronizationContext.Current
Context.Post(delegate
{
textBox.Text += "Notified!\n";
}, null)
);
and finally call the client side method from your server side :
public void ServerNotify()
{
context.Clients.Others.notify(stock);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.