|
-
Feb 26th, 2010, 10:41 AM
#1
Thread Starter
Hyperactive Member
Server-side interrupt-driven client refresh.
Scenario
I'm developing a 2 player turnbased PHP game.
Each turn can take 1 second to 10 minutes.
When player1 has made his move, then the webserver will store his move in a database. After that the 2nd player (who visits the same website but from another computer, and another useraccount) has to make his turn. Both players leave the playboard open in their webbrowser while they are playing.
The problem is: how does the browser of player 2 know when to refresh.
Usually in automation there are 2 possible solutions for this problem.
1) Polling
2) a Trigger/Interrupt
Solution 1: (the polling) is easy, I can indeed write a little ajax script that calls a php page in the background, when the php page finally returns a certain text "REFRESH-OK" then I call a javascript refresh function. So, that's indeed an easy solution.
Interrupts
But is there also something possible like interrupts?
I'm not sure but maybe this is what the HTTP-keep-alive is made for?
I think the advantages of an interrupt system are obvious.
- less data traffic
- realtime response
- less dependent of javascript
Thank you in advance
____________________________________________
Please rate my messages. Thank you!
____________________________________________
Bram Vandenbon
http://www.bramvandenbon.com
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|