You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm wondering the script below that I grabbed from Swoole website creates new connection or thread every couple of seconds and I don't like it. While yours is not which is I'm looking for. Sorry but this is not really an issue. Just want to ask or mentor me what's the idea to prevent SSE from creating new connection every couple of seconds. I want SSE to maintain that connection until that client closes or refresh the browser. Thank you in advance.
while(true):
$data = "event: ping\n";
$response->write($data);
$curDate = date(DATE_ISO8601);
$data = 'data: {"time": "' . $curDate . '"}';
$data .= "\n\n";
$response->write($data);
$counter--;
if (!$counter) {
$data = 'data: This is a message at time ' . $curDate . "\n\n";
$response->end($data);
break;
}
Coroutine::sleep(3);
endwhile;
The text was updated successfully, but these errors were encountered:
I'm wondering the script below that I grabbed from Swoole website creates new connection or thread every couple of seconds and I don't like it. While yours is not which is I'm looking for. Sorry but this is not really an issue. Just want to ask or mentor me what's the idea to prevent SSE from creating new connection every couple of seconds. I want SSE to maintain that connection until that client closes or refresh the browser. Thank you in advance.
The text was updated successfully, but these errors were encountered: