Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
775 views
in Technique[技术] by (71.8m points)

php - Error during WebSocket handshake when using laravel-websockets

I have a problem with my socket settings and it seems everything is ok but I got this error:

pusher.min.js:8 WebSocket connection to 'wss://www.example.com:8443/app/ABCDEFG?protocol=7&client=js&version=4.3.1&flash=false' failed: Error during WebSocket handshake: Unexpected response code: 426

I've checked all questions and answers with this topic but no results! Could you help me, please...

Versions of packages I've used:

  1. "pusher-js": "^7.0.0",
  2. "laravel-echo": "^1.9.0",
  3. "pusher/pusher-php-server": "~4.1",
  4. "beyondcode/laravel-websockets": "^1.9.0"

These are my bootstrap.js codes:

   window.Echo = new Echo({
broadcaster: 'pusher',
key: process.env.MIX_PUSHER_APP_KEY,
cluster: process.env.MIX_PUSHER_APP_CLUSTER,
wsHost: window.location.hostname,
wsPort: 8443,
disableStats: true,
enabledTransports: ['ws', 'wss'],
forceTLS: true,
encrypted: true,
wssPort: 8443,

});

This is also my broadcasting.php:

'connections' => [
    'pusher' =>  [
        'driver' => 'pusher',
        'key' => env('PUSHER_APP_KEY'),
        'secret' => env('PUSHER_APP_SECRET'),
        'app_id' => env('PUSHER_APP_ID'),
        'log' => true,
        'options' => [
            'cluster' => env('PUSHER_APP_CLUSTER'),
            'host' => 'example.com',
            'port' => 8443,
            'scheme' => 'https',
            //'useTLS' => true,
            'encrypted' => true,
            'curl_options' => [
                CURLOPT_SSL_VERIFYHOST => 0,
                CURLOPT_SSL_VERIFYPEER => 0,
            ]
        ]
    ],
    'redis' => [
        'driver' => 'redis',
        'connection' => 'default',
    ],

    'log' => [
        'driver' => 'log',
    ],

    'null' => [
        'driver' => 'null',
    ],

],

Here is picture of same error in firefox

I see I should provide an upgrade header, but I don't know how!

question from:https://stackoverflow.com/questions/65915080/error-during-websocket-handshake-when-using-laravel-websockets

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...