hoaproject / eventsource Goto Github PK
View Code? Open in Web Editor NEWThe Hoa\Eventsource library.
Home Page: https://hoa-project.net/
The Hoa\Eventsource library.
Home Page: https://hoa-project.net/
Somewhere inside this library some session locking seems to be occuring. Test script:
<?php
include __DIR__ . '/../protected/vendor/autoload.php';
ob_end_flush();
$server = new \Hoa\Eventsource\Server();
$i = 0;
while($i < 20) {
$i++;
$server->send(time(), $i);
sleep(1);
}
This code should send 20 messages over 20 seconds. When calling this from a server in 2 browser tabs, 1 stays empty until all 20 messages have appeared in the other, after which it starts displaying messages.
If I instead open 1 tab in private browsing mode both tabs show the messages simultaneously.
Hi,
I get this error message when trying your sample code:
Uncaught Hoa\Eventsource\Server::__construct(): (1) Client does not accept text/event-stream. in /app/public/wp-content/plugins/helpie-chat/vendor/hoa/eventsource/Server.php at line 114.
And the Eventsource works in a simple way when trying without any library like yours.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
We had some issues with a server which had output_buffering
enabled via php.ini
.
Debugging was made harder due to the fact that the Server
creates an output buffer in its constructor, which is a side effect..
Since output_get_level
will reliably tell us if output buffering is enabled, it would be nice to just throw an exception in that case:
public function __construct($verifyHeaders = true)
{
if (true === $verifyHeaders && true === headers_sent($file, $line)) {
throw new Exception(
'Headers already sent in %s at line %d, cannot send data ' .
'to client correctly.',
0,
[$file, $line]
);
}
if(ob_get_level() > 0) {
throw new Exception("Output buffering is active");
}
Alternatively output buffering could be disabled:
while (@ob_end_flush());
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
Code is not impacted a lot, it should not be an issue but we prefer to fix this for consistency.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.