-
Notifications
You must be signed in to change notification settings - Fork 43
Open
Description
Hello,
I implemented your example for my symfony 4.4 project. It works but unfortunately, I have to wait about 30s before the first console.log()'s happen in the client.
Is this a known issue?
Here's my controller:
$sse = new SSE(); //create a libSSE instance
$sse->addEventListener('event_name', new YourEventHandler());//register your event handler
$sse->start();//start the event loop
// Add your event listener
return $sse->createResponse();
class YourEventHandler implements Event {
public function update(){
//Here's the place to send data
return 'Hello, world!';
}
public function check(){
//Here's the place to check when the data needs update
return true;
}
}
js:
var sse = new EventSource('http://www.monitor.hundh.hhdev/sse.php');
sse.addEventListener('event_name',function(e){
var data = e.data;
//handle your data here
console.log(data);
},false);
When using the w3c example, it works quickly, so I guess I misconfigurated something?
Thanks in advance!
Bye Defcon0
Metadata
Metadata
Assignees
Labels
No labels