added wss tools 6
This commit is contained in:
@@ -18,9 +18,7 @@ class PriceStreamController extends Controller
|
||||
abort(404);
|
||||
}
|
||||
|
||||
$host = $service->resolveHost($request);
|
||||
|
||||
return response()->stream(function () use ($service, $host) {
|
||||
return response()->stream(function () use ($service) {
|
||||
@set_time_limit(0);
|
||||
|
||||
if (function_exists('apache_setenv')) {
|
||||
@@ -46,15 +44,13 @@ class PriceStreamController extends Controller
|
||||
$send('last', $last);
|
||||
}
|
||||
|
||||
$lastId = $host !== '' ? $service->currentSeq($host) : 0;
|
||||
$lastId = $service->currentSeq();
|
||||
$heartbeatTicks = 0;
|
||||
|
||||
while (! connection_aborted()) {
|
||||
if ($host !== '') {
|
||||
foreach ($service->consumeSince($host, $lastId) as $event) {
|
||||
$send((string) $event['event'], $event['data']);
|
||||
$lastId = (int) $event['id'];
|
||||
}
|
||||
foreach ($service->consumeSince($lastId) as $event) {
|
||||
$send((string) $event['event'], $event['data']);
|
||||
$lastId = (int) $event['id'];
|
||||
}
|
||||
|
||||
$heartbeatTicks++;
|
||||
|
||||
Reference in New Issue
Block a user