You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 7, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: docs/advanced-usage/custom-websocket-handlers.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,13 +15,13 @@ Once implemented, you will have a class that looks something like this:
15
15
```php
16
16
namespace App;
17
17
18
+
use Exception;
18
19
use Ratchet\ConnectionInterface;
19
20
use Ratchet\RFC6455\Messaging\MessageInterface;
20
21
use Ratchet\WebSocket\MessageComponentInterface;
21
22
22
23
class MyCustomWebSocketHandler implements MessageComponentInterface
23
24
{
24
-
25
25
public function onOpen(ConnectionInterface $connection)
26
26
{
27
27
// TODO: Implement onOpen() method.
@@ -32,7 +32,7 @@ class MyCustomWebSocketHandler implements MessageComponentInterface
32
32
// TODO: Implement onClose() method.
33
33
}
34
34
35
-
public function onError(ConnectionInterface $connection, \Exception $e)
35
+
public function onError(ConnectionInterface $connection, Exception $e)
36
36
{
37
37
// TODO: Implement onError() method.
38
38
}
@@ -48,12 +48,12 @@ In the class itself you have full control over all the lifecycle events of your
48
48
49
49
The only part missing is, that you will need to tell our WebSocket server to load this handler at a specific route endpoint. This can be achieved using the `WebSocketsRouter` facade.
50
50
51
-
This class takes care of registering the routes with the actual webSocket server. You can use the `webSocket` method to define a custom WebSocket endpoint. The method needs two arguments: the path where the WebSocket handled should be available and the fully qualified classname of the WebSocket handler class.
51
+
This class takes care of registering the routes with the actual webSocket server. You can use the `get` method to define a custom WebSocket endpoint. The method needs two arguments: the path where the WebSocket handled should be available and the fully qualified classname of the WebSocket handler class.
52
52
53
53
This could, for example, be done inside your `routes/web.php` file.
Copy file name to clipboardExpand all lines: docs/basic-usage/pusher.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ To make it clear, the package does not restrict connections numbers or depend on
13
13
14
14
To make use of the Laravel WebSockets package in combination with Pusher, you first need to install the official Pusher PHP SDK.
15
15
16
-
If you are not yet familiar with the concept of Broadcasting in Laravel, please take a look at the [Laravel documentation](https://laravel.com/docs/6.0/broadcasting).
16
+
If you are not yet familiar with the concept of Broadcasting in Laravel, please take a look at the [Laravel documentation](https://laravel.com/docs/8.0/broadcasting).
17
17
18
18
```bash
19
19
composer require pusher/pusher-php-server "~4.0"
@@ -99,8 +99,8 @@ To enable or disable the statistics for one of your apps, you can modify the `en
99
99
100
100
## Usage with Laravel Echo
101
101
102
-
The Laravel WebSockets package integrates nicely into [Laravel Echo](https://laravel.com/docs/6.0/broadcasting#receiving-broadcasts) to integrate into your frontend application and receive broadcasted events.
103
-
If you are new to Laravel Echo, be sure to take a look at the [official documentation](https://laravel.com/docs/6.0/broadcasting#receiving-broadcasts).
102
+
The Laravel WebSockets package integrates nicely into [Laravel Echo](https://laravel.com/docs/8.0/broadcasting#receiving-broadcasts) to integrate into your frontend application and receive broadcasted events.
103
+
If you are new to Laravel Echo, be sure to take a look at the [official documentation](https://laravel.com/docs/8.0/broadcasting#receiving-broadcasts).
104
104
105
105
To make Laravel Echo work with Laravel WebSockets, you need to make some minor configuration changes when working with Laravel Echo. Add the `wsHost` and `wsPort` parameters and point them to your Laravel WebSocket server host and port.
106
106
@@ -111,7 +111,7 @@ When using Laravel WebSockets in combination with a custom SSL certificate, be s
111
111
:::
112
112
113
113
```js
114
-
importEchofrom"laravel-echo"
114
+
importEchofrom'laravel-echo';
115
115
116
116
window.Pusher=require('pusher-js');
117
117
@@ -126,4 +126,4 @@ window.Echo = new Echo({
126
126
});
127
127
```
128
128
129
-
Now you can use all Laravel Echo features in combination with Laravel WebSockets, such as [Presence Channels](https://laravel.com/docs/7.x/broadcasting#presence-channels), [Notifications](https://laravel.com/docs/7.x/broadcasting#notifications) and [Client Events](https://laravel.com/docs/7.x/broadcasting#client-events).
129
+
Now you can use all Laravel Echo features in combination with Laravel WebSockets, such as [Presence Channels](https://laravel.com/docs/8.x/broadcasting#presence-channels), [Notifications](https://laravel.com/docs/8.x/broadcasting#notifications) and [Client Events](https://laravel.com/docs/8.x/broadcasting#client-events).
Copy file name to clipboardExpand all lines: docs/basic-usage/ssl.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,7 @@ Since most of the web's traffic is going through HTTPS, it's also crucial to sec
10
10
## Configuration
11
11
12
12
The SSL configuration takes place in your `config/websockets.php` file.
13
+
13
14
The default configuration has a SSL section that looks like this:
14
15
15
16
```php
@@ -31,6 +32,7 @@ The default configuration has a SSL section that looks like this:
31
32
```
32
33
33
34
But this is only a subset of all the available configuration options.
35
+
34
36
This packages makes use of the official PHP [SSL context options](http://php.net/manual/en/context.ssl.php).
35
37
36
38
So if you find yourself in the need of adding additional configuration settings, take a look at the PHP documentation and simply add the configuration parameters that you need.
Copy file name to clipboardExpand all lines: docs/debugging/dashboard.md
+3-12Lines changed: 3 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -71,21 +71,12 @@ protected function schedule(Schedule $schedule)
71
71
72
72
Each app contains an `enable_statistics` that defines wether that app generates statistics or not. The statistics are being stored for the `interval_in_seconds` seconds and then they are inserted in the database.
73
73
74
-
However, to disable it entirely and void any incoming statistic, you can change the statistics logger to `NullStatisticsLogger` under your current replication driver.
74
+
However, to disable it entirely and void any incoming statistic, you can call `--disable-statistics` when running the server command:
'statistics_logger' => \BeyondCode\LaravelWebSockets\Statistics\Logger\NullStatisticsLogger::class, // use the `NullStatisticsLogger` instead
76
+
```bash
77
+
php artisan websockets:serve --disable-statistics
79
78
```
80
79
81
-
## Custom Statistics Drivers
82
-
83
-
By default, the package comes with a few drivers like the Database driver which stores the data into the database.
84
-
85
-
You should add your custom drivers under the `statistics` key in `websockets.php` and create a driver class that implements the `\BeyondCode\LaravelWebSockets\Statistics\Drivers\StatisticsDriver` interface.
86
-
87
-
Take a quick look at the `\BeyondCode\LaravelWebSockets\Statistics\Drivers\DatabaseDriver` driver to see how to perform your integration.
88
-
89
80
## Event Creator
90
81
91
82
The dashboard also comes with an easy-to-use event creator, that lets you manually send events to your channels.
Copy file name to clipboardExpand all lines: docs/faq/scaling.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,3 +16,7 @@ Here is another benchmark that was run on a 2GB Digital Ocean droplet with 2 CPU
16
16

17
17
18
18
Make sure to take a look at the [Deployment Tips](/docs/laravel-websockets/faq/deploying) to find out how to improve your specific setup.
19
+
20
+
# Horizontal Scaling
21
+
22
+
When deploying to multi-node environments, you will notice that the server won't behave correctly. Check [Horizontal Scaling](../horizontal-scaling/getting-started.md) section.
0 commit comments