You are here: Re: Ajax asynchronous is it possible ? « PHP Programming Language « IT news, forums, messages
Re: Ajax asynchronous is it possible ?

Posted by Jan Thomä on 08/23/07 09:32

Hi Piotr,

> So, it doesnt make sense to poll every 5 seconds if action of building a
> house last 2 days ! Divide 2days by 5 seconds and you get number of
> waisted requests to check if action is done.

Most probably not. If you have a significant amount of players this will
simply kill your database. One approach could be to hold a queue of events
for every player in the database, together with a time when they will
trigger. Once the player logs in, this queue is loaded once by a
javascript, which will then send out the notifications based on the loaded
data without the need of queriying the database again. You just need to
make sure that the list on the client is refreshed when there are changes
to the list (e.g. the player cancels something or adds a new item into the
queue). Since these actions are triggered by the player it should not be
too difficult to do that. The only tricky part is, when you get
notifications upon actions of other players as then you would need to poll
the database. However unless the notifications should be sent in real time,
polling can be reduced to an interval of some minutes or so. Another
approach would be to add the notifications to the content that is sent
anyways to the browser when the player changes to another page...

Best regards,
Jan


--
_________________________________________________________________________
insOMnia - We never sleep...
http://www.insOMnia-hq.de

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация