Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

kyurie's avatar

Failed to connect to Pusher. (Cpanel)

I'm using laravel websocket on my local and it works fine, but when I tried to deploy it on godaddy and use my website, I'm having an error regarding to pusher.

I already tried to change my .env to pusher configuration.

BROADCAST_DRIVER=pusher
CACHE_DRIVER=file
FILESYSTEM_DRIVER=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=database
SESSION_LIFETIME=120

PUSHER_APP_ID=1316084
PUSHER_APP_KEY=bc17ddcfa709efc07d7b
PUSHER_APP_SECRET=941c1af71c2d6593f1e9
PUSHER_APP_CLUSTER=ap1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

And I this on my config/broadcasting.php

'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' => true,
                    'host' => env('APP_URL'),
                    'port' => 6001,
                    'scheme' => 'http',
                    'useTLS' => true,
            'curl_options' => [
                CURLOPT_SSL_VERIFYHOST => 0,
                CURLOPT_SSL_VERIFYPEER => 0,
            ]
        ],
    ],

my config/websockets.php

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

How to fix this? Thanks in advance

0 likes
5 replies
bobbybouwmann's avatar

What error do you get?

Also, it seems that you have scheme set to http while I would expect this to be https

1 like
kyurie's avatar

@bobbybouwmann thank you for your reply. I followed your instruction but I'm still getting error. The error is failed to connect to pusher when I tried to use the realtime functionality of my website.

bobbybouwmann's avatar

@kyurie The default config file from Laravel doesn't include all the options you have configured for Pusher. Do you really need them? Why did you configure them? And how did you know the correct values?

1 like
kyurie's avatar

@bobbybouwmann Thanks! . I'll take note of that.

I used this on my bootstrap.js

window.Echo = new Echo({
    broadcaster: 'pusher',
    key: process.env.MIX_PUSHER_APP_KEY,
    cluster: process.env.MIX_PUSHER_APP_CLUSTER,
    forceTLS: true
});

then I remove some code on my config/broadcasting.php and play with it. here's one working.

 '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' => true,
                    'useTLS' => true,
                    //  'host' => 'local',
                    //     'port' => 433,
                    'scheme' => 'http',
                    // 'scheme' => 'https',
                    'curl_options' => [
                        CURLOPT_SSL_VERIFYHOST => 0,
                        CURLOPT_SSL_VERIFYPEER => 0,
                    ],
                ],
            ],

I put all the codes above and I'm not getting error. but the realtime for front-end is not realtime. idk why.

In my local its working perfectly.

here's the another error on my console app.js:26397 WebSocket connection to 'wss://domain/app/local?protocol=7&client=js&version=7.0.3&flash=false' failed: WebSocket is closed before the connection is established.

is the problem caused by bootstrap.js? because it's for client?

kyurie's avatar

@bobbybouwmann When I use the 'scheme' => 'https' it's giving me error Failed to connect to pusher. I need https for ssl right?

Please or to participate in this conversation.