Added docs

This commit is contained in:
Alex Renoki 2020-08-27 22:18:27 +03:00
parent 0c8c5c0d9b
commit 68a3a74dfa
3 changed files with 21 additions and 1 deletions

View File

@ -214,6 +214,7 @@ return [
'logger' => \BeyondCode\LaravelWebSockets\Statistics\Logger\MemoryStatisticsLogger::class,
// 'logger' => \BeyondCode\LaravelWebSockets\Statistics\Logger\NullStatisticsLogger::class,
// 'logger' => \BeyondCode\LaravelWebSockets\Statistics\Logger\RedisStatisticsLogger::class,
/*
|--------------------------------------------------------------------------

View File

@ -32,3 +32,23 @@ Now, when your app broadcasts the message, it will make sure the connection reac
The available drivers for replication are:
- [Redis](redis)
## Configure the Statistics driver
If you work with multi-node environments, beside replication, you shall take a look at the statistics logger. Each time your user connects, disconnects or send a message, you can track the statistics. However, these are centralized in one place before they are dumped in the database.
Unfortunately, you might end up with multiple rows when multiple servers run in parallel.
To fix this, just change the `statistics.logger` class with a logger that is able to centralize the statistics in one place. For example, you might want to store them into a Redis instance:
```php
'statistics' => [
'logger' => \BeyondCode\LaravelWebSockets\Statistics\Logger\RedisStatisticsLogger::class,
...
],
```
Check the `websockets.php` config file for more details.

View File

@ -34,4 +34,3 @@ You can set the connection name to the Redis database under `redis`:
```
The connections can be found in your `config/database.php` file, under the `redis` key. It defaults to connection `default`.