OK, here's a little bit more info and questions. The text below may contain something stupid, so please be aware. I'm just getting to know this stuff.
Basically the web server and the framework already support this. What I would like to know is how to do this effectively, to support a lot of simultaneous users.
One could think this as a sort of a "long polling" mechanism. With that in mind I try to describe the problem:
One way to implement this on the server side seems to be (pseudo code in a true BASIC fashion) :
10 accept a http request (a controller method is called at this point)
20 a loop starts here
30 do await/waitfor/something similar to wait for new data to send (one could probably use actors to wait for the data)
40 send some data to the client
50 goto line 20
Now... my concern is:
- Does every http request take a dedicated thread?
- If so, this may not scale very well?
- Would this be a limitation in the language/virtual machine/web server or where?
- Could this be done in a way that only one thread would be used for all the connections, and at the point of "await" (line 30) this particular thread could handle another incoming connection?
- Am I missing something here?
So.. a lot of questions/confusion. Hope someone got something out of this and can write some advice? Thanks.