igorw/EventSource — Issue #1: Slow issue 
Author: dator
Created: 2012-01-02 22:27:38+00:00
State: open

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)

```javascript
$(function() {
var stream = new EventSource("getId(), $event->getSlug())); ?>");

stream.addEventListener('message', function (event) {
console.log(event.data);
});
});
```

```php
public function executePoll(sfWebRequest $request)
{
set_time_limit(0);
ini_set('memory_limit', '512M');
foreach (Stream::getHeaders() as $name => $value) {
header("$name: $value");
}

$stream = new Stream();

while (true) {
$stream
->event()
->setData('Hellofezfe World')
->end()
->flush();

sleep(2);
}

return sfView::NONE;
}
```