Jump to content

php ajax polling question


Wireless102

Recommended Posts

Hello,

 

I have built an application for live internet bidding (real time auction).  The question i have is, what would be the best way to update

the bids? the way i have it setup right now is, during the auction i have an automatic script running that reads the database and

writes the current bid, the username of the highest bidder and a few other items to a php file. on the client side of it (front end)

i am using a xmlHttpRequest to read the output of the file that the automatic script writes. inside that file it simply writes "echo "

currentbid,username,.....";" and the xmlhttprequest reads that as an array and updates the users front end. I do it this way to

keep from having every user that is logged into the live auction from hitting the database every 4-5 seconds to get the current bid.

it seems like this is not a very efficient way to do this and i am looking for advice on this matter if anyone has any.

 

all of the other functions such as when a user places a new bid does hit the database but i dont see that being a problem

since it is just when someone bids on an item.

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/38125-php-ajax-polling-question/
Share on other sites

i did have it setup to do the fwrite from a xmlhttprequest, i changed it to be started by a cron job that checks to see if the auction is active

and if it is active it starts a looping script that grabs the mysql data and writes the current bid information every second. its all on the server now.

thats about the best i can see for efficiency. its going to be running its first (real) live auction in a couple of weeks and i'll see then

how efficient it is. I hate to try it in a real environment but that is the only way i can find to get that many people on the auction at one time.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.