PHP code example of eliashaeussler / sse
1. Go to this page and download the library: Download eliashaeussler/sse library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
eliashaeussler / sse example snippets
use EliasHaeussler\SSE;
// Open event stream
$eventStream = SSE\Stream\SelfEmittingEventStream::create();
$eventStream->open();
// Send event
$eventStream->sendEvent(new MyCustomEvent($eventData));
// Send message
$eventStream->sendMessage('myCustomEvent', $eventData);
// Close event stream
$eventStream->close();