Add server variable

This commit is contained in:
Lukas Kämmerling 2018-12-05 12:36:02 +01:00
parent 17e0b2bbd3
commit 30d1a6b79c
4 changed files with 16 additions and 1 deletions

View File

@ -13,6 +13,7 @@ return [
[ [
'id' => env('PUSHER_APP_ID'), 'id' => env('PUSHER_APP_ID'),
'name' => env('APP_NAME'), 'name' => env('APP_NAME'),
'server' => null,
'key' => env('PUSHER_APP_KEY'), 'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'), 'secret' => env('PUSHER_APP_SECRET'),
'enable_client_messages' => false, 'enable_client_messages' => false,

View File

@ -109,7 +109,7 @@
methods: { methods: {
connect() { connect() {
this.pusher = new Pusher(this.app.key, { this.pusher = new Pusher(this.app.key, {
wsHost: window.location.hostname, wsHost: this.app.server.length === 0 ? window.location.hostname : this.app.server,
wsPort: this.port, wsPort: this.port,
disableStats: true, disableStats: true,
authEndpoint: '/{{ request()->path() }}/auth', authEndpoint: '/{{ request()->path() }}/auth',

View File

@ -18,6 +18,9 @@ class App
/** @var string|null */ /** @var string|null */
public $name; public $name;
/** @var string|null */
public $server;
/** @var bool */ /** @var bool */
public $clientMessagesEnabled = false; public $clientMessagesEnabled = false;
@ -63,6 +66,13 @@ class App
return $this; return $this;
} }
public function setServer(string $server)
{
$this->server = $server;
return $this;
}
public function enableClientMessages(bool $enabled = true) public function enableClientMessages(bool $enabled = true)
{ {
$this->clientMessagesEnabled = $enabled; $this->clientMessagesEnabled = $enabled;

View File

@ -67,6 +67,10 @@ class ConfigAppProvider implements AppProvider
$app->setName($appAttributes['name']); $app->setName($appAttributes['name']);
} }
if (isset($appAttributes['server'])) {
$app->setServer($appAttributes['server']);
}
$app $app
->enableClientMessages($appAttributes['enable_client_messages']) ->enableClientMessages($appAttributes['enable_client_messages'])
->enableStatistics($appAttributes['enable_statistics']); ->enableStatistics($appAttributes['enable_statistics']);