0

I am building ASP.NET Core application with Angular front end. Consider the following scenario. The client submits a request. Based on the request, the server generates hundreds or thousands of mathematical models that it calculates on some infrastructure (the example is somewhat hypothetical - so bear with me). The results come back to the server over several minutes. The server returns some kind of response to the client (ideally, JSON).

Is SignalR the solution for such scenario? I always imagined that SignalR is for more continuous (real-time) streaming; not for a discrete scenario that I described. Is there a different library that would be a better fit for this task?

Felix
  • 9,248
  • 10
  • 57
  • 89

1 Answers1

0

I think SignalR would be perfect for that scenario. The server needs to "tell" the client when the data is ready. How would you do that?

  1. Client asks for data every few seconds using an interval. This could be fine, but let´s say you interval lasts 10 seconds. If data is ready at second 11, you won´t get updated until second number 20. You can reduce the interval time span for this matter, getting more server calls and network waste.
  2. Client keeps a live connection to the server, listening for any signal/update. Server gets the data and then invokes a command/method in your client. With this method, you get more benefits, like reporting progress to the user (in case you can separate the model generation in different pieces on the server), as SignalR has a very simple way to do it
Community
  • 1
  • 1
xleon
  • 6,201
  • 3
  • 36
  • 52