-2

The current .NET MVC 5 web app includes a button somewhere which calls into a controller method which generates an SSRS report and then emails that to some recipients (with the proper layers but it's still one request).

After labeling this a long-running task, we've switched to using HangFire to kick off a background task. So now the controller just schedules the background task and returns a "Task started" message to the user.

As the task progresses, we want to notify the user of the task results. Searching for modern ways to do this in a .NET environments we decided to try out SignalR and its simplicity has led to a quick and easy implementation of async server-triggered notifications on the client.

Is this an overengineered application of SignalR? Would it be a better idea to just check for new alerts ones whenever the user refreshes the page? Are we wasting resources on SignalR or is the library efficient even for about 10-20 messages per hour?

devadviser
  • 120
  • 1
  • 12
  • 1
    Did you read [the documentation](https://learn.microsoft.com/en-us/aspnet/signalr/overview/getting-started/introduction-to-signalr)? It states "can scale out to thousands of clients". Did you monitor resource usage? It is proving to be a problem for you? You say it's simple, yet you're wondering if it's overengineered? – mason May 07 '18 at 18:57
  • If you don't want to use signalR, you can always implement your own polling, similar to https://www.codeproject.com/Questions/1215691/How-to-implement-AJAX-based-polling-in-ASP-NET-MVC . The question for you becomes what will scale better: the signalR framework, or 1 off ajax requests, depends on how much you use it. – RandomUs1r May 07 '18 at 22:26
  • Mason: I am not wondering about SignalR's ability to scale, I would definitely pick SignalR for intense client-server communication. I said that the implementation of the notification service is simple, not the technology behind it. – devadviser May 10 '18 at 10:26

1 Answers1

1

I'd say you're fine up to 3 updates per second - and even then you could go faster with caveats. And yes, you can easily handle hundreds on a single node.

SignalR looks ideal for your solution. It should be used by any ASP.NET site that needs real time updates.

thab
  • 666
  • 1
  • 6
  • 14