Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eventsource-client

PHP 7 implementation of EventSource as a client (aka Server-Sent Events (SSE)) Uses ReactPHP as the basis

Specification used for implementation: https://www.w3.org/TR/eventsource/

Trying to match this usage: https://developer.mozilla.org/en-US/docs/Web/API/EventSource/EventSource

Example

<?php

require __DIR__."/../vendor/autoload.php";

$loop = React\EventLoop\Factory::create();

$eventSource = new \Method\EventSource('http://127.0.0.1/eventsource-server/example.php', [], $loop);
//the eventsource-server project is a very simple implementation of https://github.com/igorw/EventSource

// example: bind to your events here
// $eventSource->on('eventName', function(Method\MessageEvent $event){ //do something } );

$loop->run();

todo

  • handle redirects
  • handle reconnects
  • handle connection failure
  • tests!
  • consider a better dependency system

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages