Fixed dashboard statistics.

This commit is contained in:
Alex Renoki 2020-09-11 09:07:57 +03:00
parent 25af2ee701
commit 18dab98d87
3 changed files with 21 additions and 10 deletions

View File

@ -347,14 +347,14 @@
name: '# Peak Connections'
},
{
x: data.websocket_message_count.x,
y: data.websocket_message_count.y,
x: data.websocket_messages_count.x,
y: data.websocket_messages_count.y,
type: 'bar',
name: '# Websocket Messages'
},
{
x: data.api_message_count.x,
y: data.api_message_count.y,
x: data.api_messages_count.x,
y: data.api_messages_count.y,
type: 'bar',
name: '# API Messages'
},

View File

@ -128,12 +128,6 @@ class StartServer extends Command
return new $class;
});
$this->laravel->singleton(StatisticsStore::class, function () {
$class = config('websockets.statistics.store');
return new $class;
});
if (! $this->option('disable-statistics')) {
$intervalInSeconds = $this->option('statistics-interval') ?: config('websockets.statistics.interval_in_seconds', 3600);

View File

@ -2,6 +2,7 @@
namespace BeyondCode\LaravelWebSockets;
use BeyondCode\LaravelWebSockets\Contracts\StatisticsStore;
use BeyondCode\LaravelWebSockets\Dashboard\Http\Controllers\AuthenticateDashboard;
use BeyondCode\LaravelWebSockets\Dashboard\Http\Controllers\SendMessage;
use BeyondCode\LaravelWebSockets\Dashboard\Http\Controllers\ShowDashboard;
@ -34,6 +35,8 @@ class WebSocketsServiceProvider extends ServiceProvider
__DIR__.'/../database/migrations/0000_00_00_000000_rename_statistics_counters.php' => database_path('migrations/0000_00_00_000000_rename_statistics_counters.php'),
], 'migrations');
$this->registerStatistics();
$this->registerDashboard();
$this->registerCommands();
@ -50,6 +53,20 @@ class WebSocketsServiceProvider extends ServiceProvider
$this->registerManagers();
}
/**
* Register the statistics-related contracts.
*
* @return void
*/
protected function registerStatistics()
{
$this->app->singleton(StatisticsStore::class, function () {
$class = config('websockets.statistics.store');
return new $class;
});
}
/**
* Regsiter the dashboard components.
*