1

I am using laravel version 5.7 and beyondcode\laravel-websockets package v1.3 the problem I am facing right now is when I am running it on localhost I am getting this error

WebSocket connection to 'wss://localhost/app/somekey?protocol=7&client=js&version=6.0.2&flash=false' failed: Error in connection establishment: net::ERR_CERT_AUTHORITY_INVALID

I have changed encrypted to false in bootsrap.js still it connects to wss instead of ws

bootstrap.js

import Echo from 'laravel-echo'

window.Pusher = require('pusher-js');

window.Echo = new Echo({
    broadcaster: 'pusher',
    key: process.env.MIX_PUSHER_APP_KEY,
    cluster: process.env.MIX_PUSHER_APP_CLUSTER,
    encrypted: false,
    wsHost: window.location.hostname,
    wsPort: 6001,
    disableStats: true
});

broadcasting.php config

'connections' => [

        'pusher' => [
            'driver' => 'pusher',
            'key' => env('PUSHER_APP_KEY'),
            'secret' => env('PUSHER_APP_SECRET'),
            'app_id' => env('PUSHER_APP_ID'),
            'options' => [
                'cluster' => env('PUSHER_APP_CLUSTER'),
                'encrypted' => false,
                'host' => '127.0.0.1',
                'port' => 6001,
                'scheme' => 'http'
            ],
        ],
Kamran
  • 523
  • 6
  • 18
sam
  • 11
  • 5

2 Answers2

1

Add this line to the config,dont forget to compile

enabledTransports: ['ws'],

If this doesnt work try to downgrade pusher.js to 4.3

Mihai
  • 26,325
  • 7
  • 66
  • 81
-1

In case somebody else sees this, I've solved it once I stopped going through https://www.mypage.com and use http://www.mypage.com

Just change the protocol on your browser from https to http

Dante
  • 711
  • 10
  • 21