Closed dator-zz closed 12 years ago
@dator you should avoid the loop in your action. EventSource is designed to reconnect itself after a closed connection.
You may tweak the retry
value (in the headers, not part of the lib for now, I'm thinking about adding it) to configure your delay.
What do you think ?
I cannot reproduce the slowness with apache 2.2.20 and chrome 16. In what env is this happening?
@igorw Server version: Apache/2.2.20 (Unix) Chrome: 16.0.912.63 PHP 5.3.8
Maybe Symfony 1.4 ?
@willdurand I haven't dug a lot on EventSource so I cannot tell you but i found the project very interesting (HTML5 part and igor's work) .
yep :)
Also I'll write the code of the action like that:
<?php
public function executePoll(sfWebRequest $request)
{
set_time_limit(0);
ini_set('memory_limit', '512M');
$this->getResponse()->clearHttpHeaders();
foreach (Stream::getHeaders() as $name => $value) {
$this->getResponse()->setHttpHeader($name, $value);
}
$this->getResponse()->sendHttpHeaders();
$stream = new Stream();
$stream
->event()
->setData('Hello')
->end()
->flush();
return sfView::NONE;
}
@willdurand You'll have to call $response->sendHttpHeaders()
before you call flush().
Oh yes :x
@willdurand @igorw Nice ! No more slow :) But how can tell "Set response to client every 10 seconds ?" there is no more "Wait" part ^^?
Again thanks a lot ;)
@dator see my comments in #2, imo closing the connection every time is not really a solution.
you're fast ! Thanks !
So was your slowness caused by the reconnect/retry value?
Yep ! totally ! :)
What should we conclude then ?
Envoyé de mon iPhone
Le 3 janv. 2012 à 00:54, Clément JOBEILIreply@reply.github.com a écrit :
Yep ! totally ! :)
Reply to this email directly or view it on GitHub: https://github.com/igorw/EventSource/issues/1#issuecomment-3335055
I'm not sure, as I was not able to reproduce the issue.
Hey !
Just try your EventSource project ! It's pretty cool !
First loading of the page is fast but if i refresh the page the page take the normal loading time + the sleep value (defined in the while loop) to load .
Is this normal ?
Here is my code (on symfony1.4)