diff --git a/config/websockets.php b/config/websockets.php index 877bb77..b3b1f7a 100644 --- a/config/websockets.php +++ b/config/websockets.php @@ -40,6 +40,7 @@ return [ * Middleware that will be applied to the dashboard routes. */ 'middleware' => [ + 'web', Authorize::class, ], ], diff --git a/resources/views/dashboard.blade.php b/resources/views/dashboard.blade.php index eba91f4..88269b7 100644 --- a/resources/views/dashboard.blade.php +++ b/resources/views/dashboard.blade.php @@ -105,7 +105,13 @@ this.pusher = new Pusher(this.client.appKey, { wsHost: window.location.hostname, wsPort: this.port, + disableStats: true, authEndpoint: '{{ config('websockets.dashboard.path') }}/auth', + auth: { + headers: { + 'X-CSRF-Token': "{{ csrf_token() }}" + } + }, enabledTransports: ['ws', 'flash'] }); @@ -166,6 +172,7 @@ sendEvent() { $.post('{{ config('websockets.dashboard.path') }}/event', { + _token: '{{ csrf_token() }}', key: this.client.appKey, secret: this.client.appSecret, appId: this.client.appId,