Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.

Commit 68a3a74

Browse files
committed
Added docs
1 parent 0c8c5c0 commit 68a3a74

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

config/websockets.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@
214214

215215
'logger' => \BeyondCode\LaravelWebSockets\Statistics\Logger\MemoryStatisticsLogger::class,
216216
// 'logger' => \BeyondCode\LaravelWebSockets\Statistics\Logger\NullStatisticsLogger::class,
217+
// 'logger' => \BeyondCode\LaravelWebSockets\Statistics\Logger\RedisStatisticsLogger::class,
217218

218219
/*
219220
|--------------------------------------------------------------------------

docs/horizontal-scaling/getting-started.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,23 @@ Now, when your app broadcasts the message, it will make sure the connection reac
3232
The available drivers for replication are:
3333

3434
- [Redis](redis)
35+
36+
## Configure the Statistics driver
37+
38+
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.
39+
40+
Unfortunately, you might end up with multiple rows when multiple servers run in parallel.
41+
42+
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:
43+
44+
```php
45+
'statistics' => [
46+
47+
'logger' => \BeyondCode\LaravelWebSockets\Statistics\Logger\RedisStatisticsLogger::class,
48+
49+
...
50+
51+
],
52+
```
53+
54+
Check the `websockets.php` config file for more details.

docs/horizontal-scaling/redis.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,3 @@ You can set the connection name to the Redis database under `redis`:
3434
```
3535

3636
The connections can be found in your `config/database.php` file, under the `redis` key. It defaults to connection `default`.
37-

0 commit comments

Comments
 (0)