laravel-websockets icon indicating copy to clipboard operation
laravel-websockets copied to clipboard

WSS Connection error

Open AmityTek opened this issue 2 years ago • 11 comments

Hello,

I have a strange problem with WSS, only WS is working but I really need the WSS

My dependencies :

Composer json : - "beyondcode/laravel-websockets": "^1.13", package-json : - "jquery": "^3.6.0", - "laravel-echo": "^1.11.3", - "pusher-js": "^4.4.0", - "visibilityjs": "^2.0.2"

Broadcasting.php

 [
            'driver' => 'pusher',
            'key' => env('PUSHER_APP_KEY', 'fatehdnlwrnncffhjewf'),
            'secret' => env('PUSHER_APP_SECRET', 'eerrpmlmqkahxbqnklhrt'),
            'app_id' => env('PUSHER_APP_ID', 'hijfeihaswgeojzapoza'),
            'options' => [
                'cluster' => env('PUSHER_APP_CLUSTER', 'mt1'),
                'port' => 6002,
                'useTLS' => false,
                'encrypted'=> false,
                'host' => 'blabla.com',
                'scheme' => 'https',
                'curl_options' => [
                    CURLOPT_SSL_VERIFYHOST => 0,
                    CURLOPT_SSL_VERIFYPEER => 0,
                ]
         ],
]

index.js

window.Echo = new Echo({
    broadcaster: 'pusher',
    key: 'fatehdnlwrnncffhjewf',
    cluster: 'mt1',
    wsHost: window.location.hostname,
    wssPort: 6002,
    wsPort: 6002,
    enableStats: true,
    encrypted: true,
    enabledTransports: ['ws', 'wss'] 
})

websocket.php

       [
            'id' => env('PUSHER_APP_ID', 'hijfeihaswgeojzapoza'),
            'name' => env('APP_NAME'),
            'key' => env('PUSHER_APP_KEY', 'fatehdnlwrnncffhjewf'),
            'secret' => env('PUSHER_APP_SECRET', 'eerrpmlmqkahxbqnklhrt'),
            'path' => env('PUSHER_APP_PATH'),
            'cluster' => 'mt1',
            'capacity' => null,
            'enable_client_messages' => true,
            'enable_statistics' => true,
            'encrypted' => false,
        ]

Also, I set the url with letsencrypt ssl key.

the message error is : WebSocket connection to 'wss://blabla.com:6002/app/fatehdnlwrnncffhjewf?protocol=7&client=js&version=4.4.0&flash=false' failed:

AmityTek avatar Mar 10 '22 09:03 AmityTek

https://github.com/beyondcode/laravel-websockets/issues/920#issuecomment-1010956181

erikn69 avatar Mar 14 '22 15:03 erikn69

https://github.com/beyondcode/laravel-websockets/issues/962#issue-1164941119

In Broadcasting.php,

'encrypted'=> true,

try again ?

MilesHan avatar Mar 20 '22 17:03 MilesHan

Let me check and I'll come back quickly

AmityTek avatar Mar 21 '22 09:03 AmityTek

#962 (comment)

In Broadcasting.php,

'encrypted'=> true,

try again ?

I already did that and still not working ...

Really strange, output console.dev

image

AmityTek avatar Mar 29 '22 15:03 AmityTek

@AmityTek did you fin solution?

Marsad1998 avatar Apr 03 '22 12:04 Marsad1998

I am facing the same problem on the server, in terminal shows that Starting the WebSocket server on port 6001... and nothing happened. But in local, this is working fine. I didn't add any SSL certificate for WebSocket is it ok or not?

nayeemdev avatar Apr 11 '22 04:04 nayeemdev

@nayeemdev If you manage to fix the issue, let me please share.

My app is hosted on digital ocean

Fajendagba avatar Apr 19 '22 22:04 Fajendagba

@nayeemdev If you manage to fix the issue, let me please share.

My app is hosted on digital ocean

@Fajendagba I didn't able to run this into server anyhow, at last I removed laravel-websocket and work with only pusher

nayeemdev avatar Apr 22 '22 06:04 nayeemdev

@nayeemdev alright man

Fajendagba avatar Apr 22 '22 06:04 Fajendagba

If you're doing Proxy server, follow this https://www.batra.dev/blog/websocket-laravel-forge-ssl-configuration

manshu avatar Apr 29 '22 00:04 manshu

@manshu please access is denied to the page

Fajendagba avatar Apr 29 '22 04:04 Fajendagba

Still relevant today, I have a let's encrypt certificate and I can't make the websocket server work:

Pusher error: cURL error 35: OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to xxxxxx.org:6001

alessandrobelli avatar Nov 06 '23 10:11 alessandrobelli