PHP Classes

Comet Problems

Recommend this page to a friend!

      Top level forums  >  PHP Specialists  >  General  >  Comet Problems  
Subject:Comet Problems
Summary:Problem deploying a comet application in PHP
Messages:2
Author:Abius X
Date:2009-07-11 20:09:24
Update:2009-07-13 06:52:51
 

  1. Comet Problems   Reply   Report abuse  
Picture of Abius X Abius X - 2009-07-11 20:15:17
Hi, I've had a particular problem when trying to implement a comet system:

had a backend.php, and a comet.php and another ajax.php, as follows:

comet.php was the main page, which had
* a jararcphpt)fqlatiol(tpdatijc qmmd)pdxt)dhdl`$0@!2A(*ci*h`pekd)nkinokd/sj!ccendn`(pep$5@!2C).ca*ahcs!ddkl/sa*ahfp(pkw)thsd!da{f"o}ka d%xd{r/hep$5@!5@$5@!2Ackendn`(pkw!skt(uk`!ra|lelko.eeb#;A.dkh!de`$5@'8A* a while which would send time every second (to make sure everything is alive) and a value known as X from the database.
Also it sent these values in some script that would trigger the update function in comet.php

ajax.php had
* some logic to change value X from the $_GET and return the time after that.

-------
So, what i expected was to run comet.php, see a page which shows time continuesly, and i expected when i wrote something in the text field and clicked send, the ajax call would call ajax.php and update X, so the text on the screen be changed to X, and an alert with time be shown. (the ajax callback would alert the data returned)

But what happens is, Time is pushed by the server, but when i write something and try to send it, nothing happens.

So i limited the while in backend.php to work only 10 seconds. This way, when i click send, after 10 seconds the ajax call works and respond arrives, of course with the time of after 10 seconds.

Thus, I wanted to know the root of the problem.
* I tampered my requests, and noticed that ajax call is send exactly when i click the send button, so the problem is not with that.
* I placed two iframes with different src (one to google and another to my localhost) and saw that they get loaded sequentially.
* I used another browser (OmniWeb, i used FF first) and loaded comet.php simultaneously on both, and both started to count the timer, so the problem is not with the Apache web server (it serves that page simultaneous)
* I also opened ajax.php?comet=test in second browser while the first one was counting, and the text got changed on the first to "test".
* I also substituted the first and second browsers, no change.
* I tried opening comet.php in browser one in two tabs, but one of them gets stuck until the other finishes. The same goes for comet.php and ajax.php on one browser.

So I conclude there is a problem with the Browser, that won't let two calls to server simultaneously.

Now I'm wondering what should I do to get this comet sample working?
Is there a problem with the session that browser establishes? How it understands that these two are on same servers?
Should I use HTTP Headers to change this behaviour? help me plz :)

There is 1 reply in this thread, which is not being displayed.
Browsing this forum thread replies is available only to premium subscribers.


Go to the premium subscriptions page to learn how to become a premium subscriber and have full access to this forum.