I have a WebApi2 controller method that starts a long-running background process:
public IHttpActionResult LongProcess()
{
HostingEnvironment.QueueBackgroundWorkItem(ct =>
{
myService.RunLongProcess(ct);
});
return Ok();
}
The RunLongProcess
is a method within a separate Services
assembly. I'm also using SignalR
in my project but currently for other purposes. SignalR
is only located in the main WebApi project
How can I use SignalR
to push notifications back to the client from the service method?
Should I start the hub in the action (within the HostingEnvironment
block and then pass a callback delegate to the method, which in turn will use SignalR
to push notifications?