Skip to content

Commit

Permalink
Merge branch 'laravel-reverb-support' into install-collaboration-command
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanmcclean committed Mar 19, 2024
2 parents 6e91adb + e669386 commit 94e5c91
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 17 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"fuse.js": "^3.4.6",
"highlight.js": "^11.7.0",
"imask": "^6.6.0-alpha.0",
"laravel-echo": "^1.6.1",
"laravel-echo": "^1.16.0",
"lowlight": "^2.8.1",
"marked": "^4.0.10",
"marked-plaintext": "0.0.2",
Expand Down
5 changes: 1 addition & 4 deletions resources/js/components/Echo.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ class Echo {

start() {
let config = {
broadcaster: 'pusher',
key: Statamic.$config.get('broadcasting.pusher.key'),
cluster: Statamic.$config.get('broadcasting.pusher.cluster'),
encrypted: Statamic.$config.get('broadcasting.pusher.encrypted'),
...Statamic.$config.get('broadcasting.options'),
csrfToken: Statamic.$config.get('csrfToken'),
authEndpoint: Statamic.$config.get('broadcasting.endpoint'),
};
Expand Down
33 changes: 25 additions & 8 deletions src/Providers/BroadcastServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,34 @@ public function boot()

protected function variables()
{
return [
'enabled' => true,
'endpoint' => $this->authEndpoint(),
'pusher' => [
$options = [];

if (config('broadcasting.default') === 'pusher') {
$options = [
'broadcaster' => 'pusher',
'key' => config('broadcasting.connections.pusher.key'),
'cluster' => config('broadcasting.connections.pusher.options.cluster'),
'encrypted' => config('broadcasting.connections.pusher.options.encrypted'),
'scheme' => config('broadcasting.connections.pusher.options.scheme'),
'host' => config('broadcasting.connections.pusher.options.host'),
'port' => config('broadcasting.connections.pusher.options.port'),
],
];
}

if (config('broadcasting.default') === 'reverb') {
$options = [
'broadcaster' => 'reverb',
'key' => config('broadcasting.connections.reverb.key'),
'wsHost' => config('broadcasting.connections.reverb.options.host'),
'wsPort' => config('broadcasting.connections.reverb.options.port', 80),
'wssPort' => config('broadcasting.connections.reverb.options.port', 443),
'forceTLS' => config('broadcasting.connections.reverb.options.useTLS'),
'enabledTransports' => ['ws', 'wss'],
];
}

return [
'enabled' => true,
'endpoint' => $this->authEndpoint(),
'connection' => config('broadcasting.default'),
'options' => $options,
];
}

Expand Down

0 comments on commit 94e5c91

Please sign in to comment.