Skip to content

Repository files navigation

EventSource / Server-Sent Events for Framework X

This package is an experimental implementation of Server-Sent Events for clue/framework-x. It doesn't require any modifications to the framework.

Feedback is welcome. Hoping to work towards an implementation that can be shipped with Framework X.

Example:

<?phpuseDevfrey\FrameworkX\EventSource\BufferedEventStream;
useDevfrey\FrameworkX\EventSource\Event;
useDevfrey\FrameworkX\EventSource\EventSourceHandler;
useReact\EventLoop\Loop;
require__DIR__ . '/vendor/autoload.php';
$app = newFrameworkX\App();
$app->get('/', newEventSourceHandler($events = newBufferedEventStream()));
// Send a random value every second
Loop::addPeriodicTimer(1.0, function () use ($events) {
$events->send((newEvent())->data(mt_rand()));
});
$app->run();

About

Experimental EventSource / Server-Sent Events implementation for Framework X.

Resources

Stars

6 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages