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

Commit

Permalink
Make it possible to customise the port the dashboard connects to (#124)
Browse files Browse the repository at this point in the history
* Make it possible to customise the port the dashboard connects to.

* Fixed so both wsPort and wssPort are changed.

* Changed env port name and added path

* Fixed typo in wsPath

* Moved port into dashboard section in config

* Changed env name to LARAVEL_WEBSOCKETS_PORT
  • Loading branch information
eldor authored and mpociot committed Sep 4, 2019
1 parent fa86844 commit 8e422cb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
8 changes: 8 additions & 0 deletions config/websockets.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@

return [

/*
* Set a custom dashboard configuration
*/
'dashboard' => [
'port' => env('LARAVEL_WEBSOCKETS_PORT', 6001),
],

/*
* This package comes with multi tenancy out of the box. Here you can
* configure the different apps that can use the webSockets server.
Expand All @@ -20,6 +27,7 @@
'name' => env('APP_NAME'),
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'path' => env('PUSHER_APP_PATH'),
'capacity' => null,
'enable_client_messages' => false,
'enable_statistics' => true,
Expand Down
7 changes: 4 additions & 3 deletions resources/views/dashboard.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@
connected: false,
chart: null,
pusher: null,
port: 6001,
app: null,
port: {{ $port }},
apps: {!! json_encode($apps) !!},
form: {
channel: null,
Expand All @@ -114,8 +114,9 @@
connect() {
this.pusher = new Pusher(this.app.key, {
wsHost: this.app.host === null ? window.location.hostname : this.app.host,
wsPort: this.port,
wssPort: this.port,
wsPort: this.port === null ? 6001 : this.port,
wssPort: this.port === null ? 6001 : this.port,
wsPath: this.app.path === null ? '' : this.app.path,
disableStats: true,
authEndpoint: '/{{ request()->path() }}/auth',
auth: {
Expand Down
1 change: 1 addition & 0 deletions src/Dashboard/Http/Controllers/ShowDashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public function __invoke(Request $request, AppProvider $apps)
{
return view('websockets::dashboard', [
'apps' => $apps->all(),
'port' => config('websockets.dashboard.port', 6001),
]);
}
}

0 comments on commit 8e422cb

Please sign in to comment.