Reputation:
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
}
Upvotes: 2
Views: 3453
Reputation: 974
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
Upvotes: 3
Reputation: 3918
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
Upvotes: 1