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

Commit 30d1a6b

Browse files
committed
Add server variable
1 parent 17e0b2b commit 30d1a6b

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

config/websockets.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
[
1414
'id' => env('PUSHER_APP_ID'),
1515
'name' => env('APP_NAME'),
16+
'server' => null,
1617
'key' => env('PUSHER_APP_KEY'),
1718
'secret' => env('PUSHER_APP_SECRET'),
1819
'enable_client_messages' => false,

resources/views/dashboard.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
methods: {
110110
connect() {
111111
this.pusher = new Pusher(this.app.key, {
112-
wsHost: window.location.hostname,
112+
wsHost: this.app.server.length === 0 ? window.location.hostname : this.app.server,
113113
wsPort: this.port,
114114
disableStats: true,
115115
authEndpoint: '/{{ request()->path() }}/auth',

src/Apps/App.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ class App
1818
/** @var string|null */
1919
public $name;
2020

21+
/** @var string|null */
22+
public $server;
23+
2124
/** @var bool */
2225
public $clientMessagesEnabled = false;
2326

@@ -63,6 +66,13 @@ public function setName(string $appName)
6366
return $this;
6467
}
6568

69+
public function setServer(string $server)
70+
{
71+
$this->server = $server;
72+
73+
return $this;
74+
}
75+
6676
public function enableClientMessages(bool $enabled = true)
6777
{
6878
$this->clientMessagesEnabled = $enabled;

src/Apps/ConfigAppProvider.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ protected function instanciate(?array $appAttributes): ?App
6767
$app->setName($appAttributes['name']);
6868
}
6969

70+
if (isset($appAttributes['server'])) {
71+
$app->setServer($appAttributes['server']);
72+
}
73+
7074
$app
7175
->enableClientMessages($appAttributes['enable_client_messages'])
7276
->enableStatistics($appAttributes['enable_statistics']);

0 commit comments

Comments
 (0)