2

this is the first time Im using pusher (pusher.com),all fine on local but on production sending notification not working, if I sent from local it works and send notification to production but send from live it is not working!!!

broadcasting:

       'pusher' => [
        'driver' => 'pusher',
        'key' => env('PUSHER_APP_KEY'),
        'secret' => env('PUSHER_APP_SECRET'),
        'app_id' => env('PUSHER_APP_ID'),
        'options' => [
        'cluster'=> env('CLUSTER'),
        'encrypted' => true,
        
        ],
    ],

sending function:

 public function OrderEvent()
{
   

$order_number='150';

    event(new OrderSubmitted($order_number));
   return "We just sent!";
}

error in production:

 production.INFO: Broadcasting [App\Events\OrderSubmitted] on channels [order-submitted] with payload:
 {
 "order_number": "15-EA",
 "socket": null
 }  
3
  • That's not an error, though. Commented Jul 13, 2020 at 19:10
  • so why in production it is not sending!!!!!!! Commented Jul 13, 2020 at 19:11
  • Did you ever find a fix for this? I am facing the same issue now. Commented Oct 19, 2020 at 6:44

3 Answers 3

3

It was because my broadcast_driver was set to log in the .env file. Change the broadcast driver in your .env from log to pusher

BROADCAST_DRIVER=pusher

And then, run this command on your production server.

php artisan config:clear

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks man, I've been pulling my hair for days because of this issue and I just realise I did not change the driver in my .env in production (face palm)
You are welcome. I am glad that you were able to resolve the issue
1

This usually happends if you haven't verified your email at pusher.

If you arleady have done that, make sure you got this in your config file. (broadcasitng.php)

      'options' => [
            'cluster' => 'ap2',
            'encrypted' => true
        ],

If none of above works, it's most likely your hostname that's misconfigured. Remember to exclude http/https from the host. It's not https://example.com, it's example.com

'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('PUSHER_HOST'),
        'port' => 6001,
        'scheme' => env('PUSHER_SCHEME')
    ],
],

and the .env file with:

PUSHER_HOST=example.com

Comments

0

I was facing the same issue, what helped me solve the issue was running:
php artisan queue:restart

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.