hhxsv5 / php-sse

A simple and efficient library implemented HTML5's server-sent events by PHP, is used to real-time push events from server to client, and easier than Websocket, instead of AJAX request.
MIT License
426 stars 49 forks source link

StopSSEException() implementation #20

Closed ljfreelancer88 closed 3 years ago

ljfreelancer88 commented 3 years ago

Hi, sorry for this noob question. When this $shouldStop variable be true? :) I'm trying to implement this condition taken from your sample demo but I don't fully get. BTW, I'm currently using your package in Swoole. Thanks again.

$shouldStop = false;
if ($shouldStop) {
    throw new StopSSEException();
}
hhxsv5 commented 3 years ago

$shouldStop is used to disconnect the current SSE connection. Such as the following example: