I want to make a mini-online browser game using ASP.NET MVC, and I ran into a problem: I need to have some kind of always-running thread that will change certain parameters over time. By sending a request - the browser will receive JSON about the state of objects in the world.

But is it even possible to create a stream that runs all the time in MVC?

  • "Some parameters" - what is that specific? - DreamChild
  • for example, there is a number k. The user sends a POST request - I change the number k to k + 1 in this thread. Another user sends a GET request at another time - I return to him already k + 1, which I get from the stream. So is it even possible that the thread is not destroyed with the completion of the request? - Vladimir Paliukhovich
  • "create thread running all the time?" -- and for what? Got parameters, calculated something. saved asleep Request has come. woke up gave the result. sleeping again - Stack
  • And if the thread does something with this number k? For example, it constantly increases it by one, or changes it according to some law ... Something like imitation of life - Vladimir Paliukhovich
  • one
    "so that the thread is not destroyed" - when the application is awakened, then the threads are taken from the pool. if there are no new requests, then after some time the application will fall asleep. - Stack

0