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

Commit 8c393c7

Browse files
committed
wip
1 parent 765e772 commit 8c393c7

File tree

2 files changed

+117
-50
lines changed

2 files changed

+117
-50
lines changed

config/websockets.php

Lines changed: 116 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,24 @@
5656
*/
5757

5858
'channel' => \BeyondCode\LaravelWebSockets\WebSockets\Channels\ChannelManagers\ArrayChannelManager::class,
59+
5960
],
6061

6162
/*
62-
* This package comes with multi tenancy out of the box. Here you can
63-
* configure the different apps that can use the webSockets server.
64-
*
65-
* Optionally you specify capacity so you can limit the maximum
66-
* concurrent connections for a specific app.
67-
*
68-
* Optionally you can disable client events so clients cannot send
69-
* messages to each other via the webSockets.
70-
*/
63+
|--------------------------------------------------------------------------
64+
| Applications Repository
65+
|--------------------------------------------------------------------------
66+
|
67+
| By default, the only allowed app is the one you define with
68+
| your PUSHER_* variables from .env.
69+
| You can configure to use multiple apps if you need to, or use
70+
| a custom App Manager that will handle the apps from a database, per se.
71+
|
72+
| You can apply multiple settings, like the maximum capacity, enable
73+
| client-to-client messages or statistics.
74+
|
75+
*/
76+
7177
'apps' => [
7278
[
7379
'id' => env('PUSHER_APP_ID'),
@@ -82,78 +88,142 @@
8288
],
8389

8490
/*
85-
* This array contains the hosts of which you want to allow incoming requests.
86-
* Leave this empty if you want to accept requests from all hosts.
87-
*/
91+
|--------------------------------------------------------------------------
92+
| Allowed Origins
93+
|--------------------------------------------------------------------------
94+
|
95+
| If not empty, you can whitelist certain origins that will be allowed
96+
| to connect to the websocket server.
97+
|
98+
*/
99+
88100
'allowed_origins' => [
89101
//
90102
],
91103

92104
/*
93-
* The maximum request size in kilobytes that is allowed for an incoming WebSocket request.
94-
*/
105+
|--------------------------------------------------------------------------
106+
| Maximum Request Size
107+
|--------------------------------------------------------------------------
108+
|
109+
| The maximum request size in kilobytes that is allowed for
110+
| an incoming WebSocket request.
111+
|
112+
*/
113+
95114
'max_request_size_in_kb' => 250,
96115

97116
/*
98-
* Define the optional SSL context for your WebSocket connections.
99-
* You can see all available options at: http://php.net/manual/en/context.ssl.php
100-
*/
117+
|--------------------------------------------------------------------------
118+
| SSL Configuration
119+
|--------------------------------------------------------------------------
120+
|
121+
| By default, the configuration allows only on HTTP. For SSL, you need
122+
| to set up the the certificate, the key, and optionally, the passphrase
123+
| for the private key.
124+
| You will need to restart the server for the settings to take place.
125+
|
126+
*/
127+
101128
'ssl' => [
102-
/*
103-
* Path to local certificate file on filesystem. It must be a PEM encoded file which
104-
* contains your certificate and private key. It can optionally contain the
105-
* certificate chain of issuers. The private key also may be contained
106-
* in a separate file specified by local_pk.
107-
*/
129+
108130
'local_cert' => env('LARAVEL_WEBSOCKETS_SSL_LOCAL_CERT', null),
109131

110-
/*
111-
* Path to local private key file on filesystem in case of separate files for
112-
* certificate (local_cert) and private key.
113-
*/
132+
'capath' => env('LARAVEL_WEBSOCKETS_SSL_CA', null),
133+
114134
'local_pk' => env('LARAVEL_WEBSOCKETS_SSL_LOCAL_PK', null),
115135

116-
/*
117-
* Passphrase for your local_cert file.
118-
*/
119136
'passphrase' => env('LARAVEL_WEBSOCKETS_SSL_PASSPHRASE', null),
137+
138+
'verify_peer' => env('APP_ENV') === 'production',
139+
140+
'allow_self_signed' => env('APP_ENV') !== 'production',
141+
120142
],
121143

122144
'statistics' => [
123145

124146
/*
125-
* This model will be used to store the statistics of the WebSocketsServer.
126-
* The only requirement is that the model should extend
127-
* `WebSocketsStatisticsEntry` provided by this package.
128-
*/
147+
|--------------------------------------------------------------------------
148+
| Statistics Eloquent Model
149+
|--------------------------------------------------------------------------
150+
|
151+
| This model will be used to store the statistics of the WebSocketsServer.
152+
| The only requirement is that the model should extend
153+
| `WebSocketsStatisticsEntry` provided by this package.
154+
|
155+
*/
156+
129157
'model' => \BeyondCode\LaravelWebSockets\Statistics\Models\WebSocketsStatisticsEntry::class,
130158

131-
/**
132-
* The Statistics Logger will, by default, handle the incoming statistics, store them
133-
* and then release them into the database on each interval defined below.
134-
*/
159+
/*
160+
|--------------------------------------------------------------------------
161+
| Statistics Logger Handler
162+
|--------------------------------------------------------------------------
163+
|
164+
| The Statistics Logger will, by default, handle the incoming statistics,
165+
| store them into an array and then store them into the database
166+
| on each interval.
167+
|
168+
*/
135169

136170
'logger' => \BeyondCode\LaravelWebSockets\Statistics\Logger::class,
137171

138172
/*
139-
* Here you can specify the interval in seconds at which statistics should be logged.
140-
*/
173+
|--------------------------------------------------------------------------
174+
| Statistics Interval Period
175+
|--------------------------------------------------------------------------
176+
|
177+
| Here you can specify the interval in seconds at which
178+
| statistics should be logged.
179+
|
180+
*/
141181

142182
'interval_in_seconds' => 60,
143183

144184
/*
145-
* When the clean-command is executed, all recorded statistics older than
146-
* the number of days specified here will be deleted.
147-
*/
185+
|--------------------------------------------------------------------------
186+
| Statistics Deletion Period
187+
|--------------------------------------------------------------------------
188+
|
189+
| When the clean-command is executed, all recorded statistics older than
190+
| the number of days specified here will be deleted.
191+
|
192+
*/
148193

149194
'delete_statistics_older_than_days' => 60,
150195

151196
/*
152-
* Use an DNS resolver to make the requests to the statistics logger
153-
* default is to resolve everything to 127.0.0.1.
154-
*/
197+
|--------------------------------------------------------------------------
198+
| DNS Lookup
199+
|--------------------------------------------------------------------------
200+
|
201+
| Use an DNS resolver to make the requests to the statistics logger
202+
| default is to resolve everything to 127.0.0.1.
203+
|
204+
*/
155205

156206
'perform_dns_lookup' => false,
207+
208+
/*
209+
|--------------------------------------------------------------------------
210+
| DNS Lookup TLS Settings
211+
|--------------------------------------------------------------------------
212+
|
213+
| You can configure the DNS Lookup Connector the TLS settings.
214+
| Check the available options here:
215+
| https://github.com/reactphp/socket/blob/master/src/Connector.php#L29
216+
|
217+
*/
218+
219+
'tls' => [
220+
221+
'verify_peer' => env('APP_ENV') === 'production',
222+
223+
'verify_peer_name' => env('APP_ENV') === 'production',
224+
225+
],
226+
157227
],
158228

159229
];

src/Console/StartWebSocketServer.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,7 @@ protected function configureStatisticsLogger()
5656
{
5757
$connector = new Connector($this->loop, [
5858
'dns' => $this->getDnsResolver(),
59-
'tls' => [
60-
'verify_peer' => config('app.env') === 'production',
61-
'verify_peer_name' => config('app.env') === 'production',
62-
],
59+
'tls' => config('websockets.statistics.tls'),
6360
]);
6461

6562
$browser = new Browser($this->loop, $connector);

0 commit comments

Comments
 (0)