The way I did this is to configure the web application as a SignalR client, route messages through SignalR from the website to the server, and then send these messages to SignalR web clients.
Start by installing the SignalR Web Client (nuget's package identifier is Microsoft.AspNet.SignalR.Client) on the website.
Then in your web project, initialize the SignalR connection concentrator and send messages to the server, for example:
public class Functions { HubConnection _hub = new HubConnection("http://your.signalr.server"); var _proxy = hub.CreateHubProxy("EmailHub"); public async Task ProcessQueueMessageAsync([QueueTrigger("queue")] EmailDto message) { if (_hub.State == ConnectionState.Disconnected) { await _hub.Start(); } ... await _proxy.Invoke("SendEmailProgress", message.Id, "complete"); } }
Your SignalR server will receive these messages and then be able to send them to other SignalR clients, for example:
public class EmailHub : Hub { public void SendEmailProgress(int messageId, string status) { Clients.All.broadcastEmailStatus(messageId, status); } }
Teppic
source share