From 121b818da1ae5d3d319d58bb2a719d490a8ba1b1 Mon Sep 17 00:00:00 2001 From: freek Date: Mon, 3 Dec 2018 12:12:53 +0100 Subject: [PATCH] wip --- config/websockets.php | 5 +++++ .../WebsocketStatisticsEntriesController.php | 21 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 src/Statistics/Http/Controllers/WebsocketStatisticsEntriesController.php diff --git a/config/websockets.php b/config/websockets.php index 63e1785..0904b0e 100644 --- a/config/websockets.php +++ b/config/websockets.php @@ -42,6 +42,11 @@ return [ */ 'max_request_size_in_kb' => 250, + /* + * This model will be used to store the statistics of the WebSocketsServer + */ + 'statistics_model' => \BeyondCode\LaravelWebSockets\Statistics\WebSocketsStatisticsEntry::class, + /* * Define the optional SSL context for your WebSocket connections. * You can see all available options at: http://php.net/manual/en/context.ssl.php diff --git a/src/Statistics/Http/Controllers/WebsocketStatisticsEntriesController.php b/src/Statistics/Http/Controllers/WebsocketStatisticsEntriesController.php new file mode 100644 index 0000000..bced6c1 --- /dev/null +++ b/src/Statistics/Http/Controllers/WebsocketStatisticsEntriesController.php @@ -0,0 +1,21 @@ +validate([ + 'app_id' => 'required', + 'peak_connections' => 'required|integer', + 'websocket_message_count' => 'required|integer', + 'api_message_count' => 'required|integer', + ]); + + WebSocketsStatisticsEntry::create($validatedAttributes); + } +} \ No newline at end of file