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

Commit 8e422cb

Browse files
eldormpociot
authored andcommitted
Make it possible to customise the port the dashboard connects to (#124)
* 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
1 parent fa86844 commit 8e422cb

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

config/websockets.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44

55
return [
66

7+
/*
8+
* Set a custom dashboard configuration
9+
*/
10+
'dashboard' => [
11+
'port' => env('LARAVEL_WEBSOCKETS_PORT', 6001),
12+
],
13+
714
/*
815
* This package comes with multi tenancy out of the box. Here you can
916
* configure the different apps that can use the webSockets server.
@@ -20,6 +27,7 @@
2027
'name' => env('APP_NAME'),
2128
'key' => env('PUSHER_APP_KEY'),
2229
'secret' => env('PUSHER_APP_SECRET'),
30+
'path' => env('PUSHER_APP_PATH'),
2331
'capacity' => null,
2432
'enable_client_messages' => false,
2533
'enable_statistics' => true,

resources/views/dashboard.blade.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@
9595
connected: false,
9696
chart: null,
9797
pusher: null,
98-
port: 6001,
9998
app: null,
99+
port: {{ $port }},
100100
apps: {!! json_encode($apps) !!},
101101
form: {
102102
channel: null,
@@ -114,8 +114,9 @@
114114
connect() {
115115
this.pusher = new Pusher(this.app.key, {
116116
wsHost: this.app.host === null ? window.location.hostname : this.app.host,
117-
wsPort: this.port,
118-
wssPort: this.port,
117+
wsPort: this.port === null ? 6001 : this.port,
118+
wssPort: this.port === null ? 6001 : this.port,
119+
wsPath: this.app.path === null ? '' : this.app.path,
119120
disableStats: true,
120121
authEndpoint: '/{{ request()->path() }}/auth',
121122
auth: {

src/Dashboard/Http/Controllers/ShowDashboard.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public function __invoke(Request $request, AppProvider $apps)
1111
{
1212
return view('websockets::dashboard', [
1313
'apps' => $apps->all(),
14+
'port' => config('websockets.dashboard.port', 6001),
1415
]);
1516
}
1617
}

0 commit comments

Comments
 (0)