|
1 | 1 | <?php
|
2 | 2 |
|
3 |
| -use BeyondCode\LaravelWebSockets\Dashboard\Http\Middleware\Authorize; |
4 |
| - |
5 | 3 | return [
|
6 | 4 |
|
7 | 5 | /*
|
8 |
| - * Set a custom dashboard configuration |
9 |
| - */ |
| 6 | + |-------------------------------------------------------------------------- |
| 7 | + | Dashboard Settings |
| 8 | + |-------------------------------------------------------------------------- |
| 9 | + | |
| 10 | + | You can configure the dashboard settings from here. |
| 11 | + | |
| 12 | + */ |
| 13 | + |
10 | 14 | 'dashboard' => [
|
| 15 | + |
11 | 16 | 'port' => env('LARAVEL_WEBSOCKETS_PORT', 6001),
|
| 17 | + |
| 18 | + 'path' => 'laravel-websockets', |
| 19 | + |
| 20 | + 'middleware' => [ |
| 21 | + 'web', |
| 22 | + \BeyondCode\LaravelWebSockets\Dashboard\Http\Middleware\Authorize::class, |
| 23 | + ], |
| 24 | + |
| 25 | + ], |
| 26 | + |
| 27 | + 'managers' => [ |
| 28 | + |
| 29 | + /* |
| 30 | + |-------------------------------------------------------------------------- |
| 31 | + | Application Manager |
| 32 | + |-------------------------------------------------------------------------- |
| 33 | + | |
| 34 | + | An Application manager determines how your websocket server allows |
| 35 | + | the use of the TCP protocol based on, for example, a list of allowed |
| 36 | + | applications. |
| 37 | + | By default, it uses the defined array in the config file, but you can |
| 38 | + | anytime implement the same interface as the class and add your own |
| 39 | + | custom method to retrieve the apps. |
| 40 | + | |
| 41 | + */ |
| 42 | + |
| 43 | + 'app' => \BeyondCode\LaravelWebSockets\Apps\ConfigAppProvider::class, |
| 44 | + |
| 45 | + /* |
| 46 | + |-------------------------------------------------------------------------- |
| 47 | + | Channel Manager |
| 48 | + |-------------------------------------------------------------------------- |
| 49 | + | |
| 50 | + | When users subscribe or unsubscribe from specific channels, |
| 51 | + | the connections are stored to keep track of any interaction with the |
| 52 | + | WebSocket server. |
| 53 | + | You can however add your own implementation that will help the store |
| 54 | + | of the channels alongside their connections. |
| 55 | + | |
| 56 | + */ |
| 57 | + |
| 58 | + 'channel' => \BeyondCode\LaravelWebSockets\WebSockets\Channels\ChannelManagers\ArrayChannelManager::class, |
| 59 | + |
12 | 60 | ],
|
13 | 61 |
|
14 | 62 | /*
|
15 |
| - * This package comes with multi tenancy out of the box. Here you can |
16 |
| - * configure the different apps that can use the webSockets server. |
17 |
| - * |
18 |
| - * Optionally you specify capacity so you can limit the maximum |
19 |
| - * concurrent connections for a specific app. |
20 |
| - * |
21 |
| - * Optionally you can disable client events so clients cannot send |
22 |
| - * messages to each other via the webSockets. |
23 |
| - */ |
| 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 | + |
24 | 77 | 'apps' => [
|
25 | 78 | [
|
26 | 79 | 'id' => env('PUSHER_APP_ID'),
|
|
35 | 88 | ],
|
36 | 89 |
|
37 | 90 | /*
|
38 |
| - * This class is responsible for finding the apps. The default provider |
39 |
| - * will use the apps defined in this config file. |
40 |
| - * |
41 |
| - * You can create a custom provider by implementing the |
42 |
| - * `AppProvider` interface. |
43 |
| - */ |
44 |
| - 'app_provider' => BeyondCode\LaravelWebSockets\Apps\ConfigAppProvider::class, |
| 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 | + */ |
45 | 99 |
|
46 |
| - /* |
47 |
| - * This array contains the hosts of which you want to allow incoming requests. |
48 |
| - * Leave this empty if you want to accept requests from all hosts. |
49 |
| - */ |
50 | 100 | 'allowed_origins' => [
|
51 | 101 | //
|
52 | 102 | ],
|
53 | 103 |
|
54 | 104 | /*
|
55 |
| - * The maximum request size in kilobytes that is allowed for an incoming WebSocket request. |
56 |
| - */ |
| 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 | + |
57 | 114 | 'max_request_size_in_kb' => 250,
|
58 | 115 |
|
59 | 116 | /*
|
60 |
| - * This path will be used to register the necessary routes for the package. |
61 |
| - */ |
62 |
| - 'path' => 'laravel-websockets', |
| 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 | + |
| 128 | + 'ssl' => [ |
| 129 | + |
| 130 | + 'local_cert' => env('LARAVEL_WEBSOCKETS_SSL_LOCAL_CERT', null), |
| 131 | + |
| 132 | + 'capath' => env('LARAVEL_WEBSOCKETS_SSL_CA', null), |
| 133 | + |
| 134 | + 'local_pk' => env('LARAVEL_WEBSOCKETS_SSL_LOCAL_PK', null), |
| 135 | + |
| 136 | + 'passphrase' => env('LARAVEL_WEBSOCKETS_SSL_PASSPHRASE', null), |
| 137 | + |
| 138 | + 'verify_peer' => env('APP_ENV') === 'production', |
| 139 | + |
| 140 | + 'allow_self_signed' => env('APP_ENV') !== 'production', |
63 | 141 |
|
64 |
| - /* |
65 |
| - * Dashboard Routes Middleware |
66 |
| - * |
67 |
| - * These middleware will be assigned to every dashboard route, giving you |
68 |
| - * the chance to add your own middleware to this list or change any of |
69 |
| - * the existing middleware. Or, you can simply stick with this list. |
70 |
| - */ |
71 |
| - 'middleware' => [ |
72 |
| - 'web', |
73 |
| - Authorize::class, |
74 | 142 | ],
|
75 | 143 |
|
76 | 144 | 'statistics' => [
|
| 145 | + |
77 | 146 | /*
|
78 |
| - * This model will be used to store the statistics of the WebSocketsServer. |
79 |
| - * The only requirement is that the model should extend |
80 |
| - * `WebSocketsStatisticsEntry` provided by this package. |
81 |
| - */ |
| 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 | + |
82 | 157 | 'model' => \BeyondCode\LaravelWebSockets\Statistics\Models\WebSocketsStatisticsEntry::class,
|
83 | 158 |
|
84 |
| - /** |
85 |
| - * The Statistics Logger will, by default, handle the incoming statistics, store them |
86 |
| - * and then release them into the database on each interval defined below. |
87 |
| - */ |
| 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 | + */ |
| 169 | + |
88 | 170 | 'logger' => \BeyondCode\LaravelWebSockets\Statistics\Logger::class,
|
89 | 171 |
|
90 | 172 | /*
|
91 |
| - * Here you can specify the interval in seconds at which statistics should be logged. |
92 |
| - */ |
| 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 | + */ |
| 181 | + |
93 | 182 | 'interval_in_seconds' => 60,
|
94 | 183 |
|
95 | 184 | /*
|
96 |
| - * When the clean-command is executed, all recorded statistics older than |
97 |
| - * the number of days specified here will be deleted. |
98 |
| - */ |
| 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 | + */ |
| 193 | + |
99 | 194 | 'delete_statistics_older_than_days' => 60,
|
100 | 195 |
|
101 | 196 | /*
|
102 |
| - * Use an DNS resolver to make the requests to the statistics logger |
103 |
| - * default is to resolve everything to 127.0.0.1. |
104 |
| - */ |
| 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 | + */ |
| 205 | + |
105 | 206 | 'perform_dns_lookup' => false,
|
106 |
| - ], |
107 | 207 |
|
108 |
| - /* |
109 |
| - * Define the optional SSL context for your WebSocket connections. |
110 |
| - * You can see all available options at: http://php.net/manual/en/context.ssl.php |
111 |
| - */ |
112 |
| - 'ssl' => [ |
113 | 208 | /*
|
114 |
| - * Path to local certificate file on filesystem. It must be a PEM encoded file which |
115 |
| - * contains your certificate and private key. It can optionally contain the |
116 |
| - * certificate chain of issuers. The private key also may be contained |
117 |
| - * in a separate file specified by local_pk. |
118 |
| - */ |
119 |
| - 'local_cert' => env('LARAVEL_WEBSOCKETS_SSL_LOCAL_CERT', null), |
| 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 | + */ |
120 | 218 |
|
121 |
| - /* |
122 |
| - * Path to local private key file on filesystem in case of separate files for |
123 |
| - * certificate (local_cert) and private key. |
124 |
| - */ |
125 |
| - 'local_pk' => env('LARAVEL_WEBSOCKETS_SSL_LOCAL_PK', null), |
| 219 | + 'tls' => [ |
| 220 | + |
| 221 | + 'verify_peer' => env('APP_ENV') === 'production', |
| 222 | + |
| 223 | + 'verify_peer_name' => env('APP_ENV') === 'production', |
| 224 | + |
| 225 | + ], |
126 | 226 |
|
127 |
| - /* |
128 |
| - * Passphrase for your local_cert file. |
129 |
| - */ |
130 |
| - 'passphrase' => env('LARAVEL_WEBSOCKETS_SSL_PASSPHRASE', null), |
131 | 227 | ],
|
132 | 228 |
|
133 |
| - /* |
134 |
| - * Channel Manager |
135 |
| - * This class handles how channel persistence is handled. |
136 |
| - * By default, persistence is stored in an array by the running webserver. |
137 |
| - * The only requirement is that the class should implement |
138 |
| - * `ChannelManager` interface provided by this package. |
139 |
| - */ |
140 |
| - 'channel_manager' => \BeyondCode\LaravelWebSockets\WebSockets\Channels\ChannelManagers\ArrayChannelManager::class, |
141 | 229 | ];
|
0 commit comments