Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your proposed solution sounds like <a href="https://stackoverflow.com/questions/333664/simple-long-polling-example-code">long polling</a>, which could work really well.</p> <p>You would request <code>/game/17/move/5</code> and the server will not send any data, until move 5 has been completed. If the connection drops, or you get a time-out, you simply reconnect until you get a valid response.</p> <p>The benefit of this is it's very quick - as soon as the server has new data, the client will get it. It's also resilient to dropped connections, and works if the client is disconnected for a while (you could request <code>/game/17/move/5</code> an hour after it's been moved and get the data instantly, then move onto <code>move/6/</code> and so on)</p> <p>The issue with long polling is each "poll" ties up a server thread, which quickly breaks servers like Apache (as it runs out of worker-threads, so can't accept other requests). You need a specialised web-server to serve the long-polling requests.. The Python module <a href="http://twistedmatrix.com/trac/" rel="nofollow noreferrer"><code>twisted</code></a> (an "an event-driven networking engine") is great for this, but it's more work than regular polling..</p> <p>In answer to your comment about Jetty/Tomcat, I don't have any experience with Java, but it seems they both use a similar pool-of-worker-threads system to Apache, so it will have that same problem. I did find <a href="http://www.ibm.com/developerworks/web/library/wa-aj-hiperform/index.html" rel="nofollow noreferrer">this post</a> which seems to address exactly this problem (for Tomcat)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload