0

I am using pusher in laravel to send notification but i'm getting following error:

{message: "Failed to connect to Pusher.", exception: "Illuminate\Broadcasting\BroadcastException",…} exception: "Illuminate\Broadcasting\BroadcastException" file: "C:\wamp64\www\notify\vendor\laravel\framework\src\Illuminate\Broadcasting\Broadcasters\PusherBroadcaster.php" line: 121 message: "Failed to connect to Pusher."

.env:

APP_URL=http://localhost
BROADCAST_DRIVER=pusher
PUSHER_APP_ID=XXX
PUSHER_APP_KEY=XXXX
PUSHER_APP_SECRET=XXX
PUSHER_APP_CLUSTER=ap2

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'),
                'useTLS' => false,
                'host' => '127.0.0.1',
                'port' => 6001,
                'scheme' => 'http',
                'curl_options' => [
                    CURLOPT_SSL_VERIFYHOST => 0,
                    CURLOPT_SSL_VERIFYPEER => 0,
                ],
                
            ],
user3653474
  • 3,393
  • 6
  • 49
  • 135

1 Answers1

0

Unfortunately, there are several things that might cause this. The one that gets me over and over again, though is that the time on my server is out of sync with the allowance window from Pusher. This happens on one of my VMs when I sleep the laptop.

Check your logs, and check your VM system time. If it is more than a tiny bit out, this could be your issue.

To fix the time issue on a Linux server (and then try again), you can use NTP if you don't have another way:

sudo apt install ntpdate
sudo ntpdate ntp.ubuntu.com
sudo timedatectl set-ntp on
sudo service ntp stop
sudo ntpd -gq
sudo service ntp start
Watercayman
  • 7,970
  • 10
  • 31
  • 49