wip
This commit is contained in:
commit
1f7c2aafab
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace BeyondCode\LaravelWebSockets\Facades;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Facade;
|
||||||
|
|
||||||
|
/** @see \BeyondCode\LaravelWebSockets\Statistics\Logging\Logger */
|
||||||
|
class StatisticsLogger extends Facade
|
||||||
|
{
|
||||||
|
protected static function getFacadeAccessor()
|
||||||
|
{
|
||||||
|
return 'websockets.statisticslogger';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -49,7 +49,7 @@ class Logger
|
||||||
|
|
||||||
protected function initializeStatistics($id)
|
protected function initializeStatistics($id)
|
||||||
{
|
{
|
||||||
if (!isset($this->statistics[$connection->app->id])) {
|
if (!isset($this->statistics[$id])) {
|
||||||
$this->statistics[$id] = new Statistic($id);
|
$this->statistics[$id] = new Statistic($id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
namespace BeyondCode\LaravelWebSockets\WebSockets;
|
namespace BeyondCode\LaravelWebSockets\WebSockets;
|
||||||
|
|
||||||
use BeyondCode\LaravelWebSockets\Dashboard\DashboardLogger;
|
use BeyondCode\LaravelWebSockets\Dashboard\DashboardLogger;
|
||||||
use BeyondCode\LaravelWebSockets\Events\ConnectionEstablished;
|
use BeyondCode\LaravelWebSockets\Facades\StatisticsLogger;
|
||||||
use BeyondCode\LaravelWebSockets\WebSockets\Exceptions\WebSocketException;
|
use BeyondCode\LaravelWebSockets\WebSockets\Exceptions\WebSocketException;
|
||||||
use BeyondCode\LaravelWebSockets\WebSockets\Messages\PusherMessageFactory;
|
use BeyondCode\LaravelWebSockets\WebSockets\Messages\PusherMessageFactory;
|
||||||
use BeyondCode\LaravelWebSockets\QueryParameters;
|
use BeyondCode\LaravelWebSockets\QueryParameters;
|
||||||
|
|
@ -90,6 +90,8 @@ class WebSocketHandler implements MessageComponentInterface
|
||||||
|
|
||||||
DashboardLogger::connection($connection);
|
DashboardLogger::connection($connection);
|
||||||
|
|
||||||
|
StatisticsLogger::connection($connection);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -8,6 +8,7 @@ use BeyondCode\LaravelWebSockets\Dashboard\Http\Controllers\ShowDashboard;
|
||||||
use BeyondCode\LaravelWebSockets\Dashboard\Http\Middleware\Authorize;
|
use BeyondCode\LaravelWebSockets\Dashboard\Http\Middleware\Authorize;
|
||||||
use BeyondCode\LaravelWebSockets\Server\Router;
|
use BeyondCode\LaravelWebSockets\Server\Router;
|
||||||
use BeyondCode\LaravelWebSockets\Statistics\Http\Controllers\WebsocketStatisticsEntriesController;
|
use BeyondCode\LaravelWebSockets\Statistics\Http\Controllers\WebsocketStatisticsEntriesController;
|
||||||
|
use BeyondCode\LaravelWebSockets\Statistics\Logging\Logger;
|
||||||
use Illuminate\Support\Facades\Gate;
|
use Illuminate\Support\Facades\Gate;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
use BeyondCode\LaravelWebSockets\Apps\AppProvider;
|
use BeyondCode\LaravelWebSockets\Apps\AppProvider;
|
||||||
|
|
@ -51,6 +52,10 @@ class WebSocketsServiceProvider extends ServiceProvider
|
||||||
return new ChannelManager();
|
return new ChannelManager();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$this->app->singleton('websockets.statisticslogger', function() {
|
||||||
|
return new Logger(app(ChannelManager::class));
|
||||||
|
});
|
||||||
|
|
||||||
$this->app->singleton(AppProvider::class, function() {
|
$this->app->singleton(AppProvider::class, function() {
|
||||||
return app(config('websockets.app_provider'));
|
return app(config('websockets.app_provider'));
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue