Skip to content

Commit 1c21ab6

Browse files
committed
feat(phase-11): wire channels route and add Reverb server config
- Register routes/channels.php in bootstrap/app.php so channel authorization runs on broadcast auth requests - Add config/reverb.php (published by reverb:install) - Update root package.json/package-lock.json with laravel-echo + pusher-js Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 3dedafc commit 1c21ab6

4 files changed

Lines changed: 191 additions & 23 deletions

File tree

erp/bootstrap/app.php

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

77
return Application::configure(basePath: dirname(__DIR__))
88
->withRouting(
9+
channels: __DIR__.'/../routes/channels.php',
910
web: __DIR__ . '/../routes/web.php',
1011
api: __DIR__ . '/../routes/api.php',
1112
commands: __DIR__ . '/../routes/console.php',

erp/config/reverb.php

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
<?php
2+
3+
return [
4+
5+
/*
6+
|--------------------------------------------------------------------------
7+
| Default Reverb Server
8+
|--------------------------------------------------------------------------
9+
|
10+
| This option controls the default server used by Reverb to handle
11+
| incoming messages as well as broadcasting message to all your
12+
| connected clients. At this time only "reverb" is supported.
13+
|
14+
*/
15+
16+
'default' => env('REVERB_SERVER', 'reverb'),
17+
18+
/*
19+
|--------------------------------------------------------------------------
20+
| Reverb Servers
21+
|--------------------------------------------------------------------------
22+
|
23+
| Here you may define details for each of the supported Reverb servers.
24+
| Each server has its own configuration options that are defined in
25+
| the array below. You should ensure all the options are present.
26+
|
27+
*/
28+
29+
'servers' => [
30+
31+
'reverb' => [
32+
'host' => env('REVERB_SERVER_HOST', '0.0.0.0'),
33+
'port' => env('REVERB_SERVER_PORT', 8080),
34+
'path' => env('REVERB_SERVER_PATH', ''),
35+
'hostname' => env('REVERB_HOST'),
36+
'options' => [
37+
'tls' => [],
38+
],
39+
'max_request_size' => env('REVERB_MAX_REQUEST_SIZE', 10_000),
40+
'scaling' => [
41+
'enabled' => env('REVERB_SCALING_ENABLED', false),
42+
'channel' => env('REVERB_SCALING_CHANNEL', 'reverb'),
43+
'server' => [
44+
'url' => env('REDIS_URL'),
45+
'host' => env('REDIS_HOST', '127.0.0.1'),
46+
'port' => env('REDIS_PORT', '6379'),
47+
'username' => env('REDIS_USERNAME'),
48+
'password' => env('REDIS_PASSWORD'),
49+
'database' => env('REDIS_DB', '0'),
50+
'timeout' => env('REDIS_TIMEOUT', 60),
51+
],
52+
],
53+
'pulse_ingest_interval' => env('REVERB_PULSE_INGEST_INTERVAL', 15),
54+
'telescope_ingest_interval' => env('REVERB_TELESCOPE_INGEST_INTERVAL', 15),
55+
],
56+
57+
],
58+
59+
/*
60+
|--------------------------------------------------------------------------
61+
| Reverb Applications
62+
|--------------------------------------------------------------------------
63+
|
64+
| Here you may define how Reverb applications are managed. If you choose
65+
| to use the "config" provider, you may define an array of apps which
66+
| your server will support, including their connection credentials.
67+
|
68+
*/
69+
70+
'apps' => [
71+
72+
'provider' => 'config',
73+
74+
'apps' => [
75+
[
76+
'key' => env('REVERB_APP_KEY'),
77+
'secret' => env('REVERB_APP_SECRET'),
78+
'app_id' => env('REVERB_APP_ID'),
79+
'options' => [
80+
'host' => env('REVERB_HOST'),
81+
'port' => env('REVERB_PORT', 443),
82+
'scheme' => env('REVERB_SCHEME', 'https'),
83+
'useTLS' => env('REVERB_SCHEME', 'https') === 'https',
84+
],
85+
'allowed_origins' => ['*'],
86+
'ping_interval' => env('REVERB_APP_PING_INTERVAL', 60),
87+
'activity_timeout' => env('REVERB_APP_ACTIVITY_TIMEOUT', 30),
88+
'max_connections' => env('REVERB_APP_MAX_CONNECTIONS'),
89+
'max_message_size' => env('REVERB_APP_MAX_MESSAGE_SIZE', 10_000),
90+
'accept_client_events_from' => env('REVERB_APP_ACCEPT_CLIENT_EVENTS_FROM', 'members'),
91+
'rate_limiting' => [
92+
'enabled' => env('REVERB_APP_RATE_LIMITING_ENABLED', false),
93+
'max_attempts' => env('REVERB_APP_RATE_LIMIT_MAX_ATTEMPTS', 60),
94+
'decay_seconds' => env('REVERB_APP_RATE_LIMIT_DECAY_SECONDS', 60),
95+
'terminate_on_limit' => env('REVERB_APP_RATE_LIMIT_TERMINATE', false),
96+
],
97+
],
98+
],
99+
100+
],
101+
102+
];

package-lock.json

Lines changed: 84 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)