wip
This commit is contained in:
parent
8bd50f0e61
commit
56bee170a9
|
|
@ -16,6 +16,7 @@ use Illuminate\Console\Command;
|
||||||
use BeyondCode\LaravelWebSockets\Server\WebSocketServerFactory;
|
use BeyondCode\LaravelWebSockets\Server\WebSocketServerFactory;
|
||||||
|
|
||||||
use React\EventLoop\Factory as LoopFactory;
|
use React\EventLoop\Factory as LoopFactory;
|
||||||
|
use React\Socket\Connector;
|
||||||
|
|
||||||
class StartWebSocketServer extends Command
|
class StartWebSocketServer extends Command
|
||||||
{
|
{
|
||||||
|
|
@ -46,9 +47,9 @@ class StartWebSocketServer extends Command
|
||||||
|
|
||||||
protected function configureStatisticsLogger()
|
protected function configureStatisticsLogger()
|
||||||
{
|
{
|
||||||
$connector = new \React\Socket\Connector($this->loop, array(
|
$connector = new Connector($this->loop, [
|
||||||
'dns' => '127.0.0.1'
|
'dns' => '127.0.0.1'
|
||||||
));
|
]);
|
||||||
|
|
||||||
$browser = new Browser($this->loop, $connector);
|
$browser = new Browser($this->loop, $connector);
|
||||||
|
|
||||||
|
|
@ -57,8 +58,7 @@ class StartWebSocketServer extends Command
|
||||||
return new HttpStatisticsLogger(app(ChannelManager::class), $browser);
|
return new HttpStatisticsLogger(app(ChannelManager::class), $browser);
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->loop->addPeriodicTimer(5, function() {
|
$this->loop->addPeriodicTimer(60, function() {
|
||||||
echo 'saving stats...';
|
|
||||||
StatisticsLogger::save();
|
StatisticsLogger::save();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,8 +65,6 @@ class HttpStatisticsLogger implements StatisticsLogger
|
||||||
|
|
||||||
public function save()
|
public function save()
|
||||||
{
|
{
|
||||||
echo 'in actual save method';
|
|
||||||
|
|
||||||
foreach ($this->statistics as $appId => $statistic) {
|
foreach ($this->statistics as $appId => $statistic) {
|
||||||
|
|
||||||
if (!$statistic->isEnabled()) {
|
if (!$statistic->isEnabled()) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue