Reputation: 103
I am having issues with sending data object to pusher, after saving data to db. When I send the request to to db , it saved to db then initialize the event but it does not send with the specified object.
event(new NotifyResponderEvent($emergencyRequest));
Here is my code for the event file
class NotifyResponderEvent implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public $emergencyRequest;
public function __construct($emergencyRequest)
{
$this->$emergencyRequest = $emergencyRequest;
}
public function broadcastOn()
{
return new Channel('request');
}
public function broadcastAs()
{
return 'emergencyRequest';
}
public function broadcastWith()
{
return [
'data' => [
$this->emergencyRequest
],
];
}
}
This is what I get in pusher after when the event is fired
{
"emergencyRequest": null
}
Even when I log the data before sending its still giving me the same issue, but it is saving on the db and sending to another api that sends sms and some object data as well.
Regards
Upvotes: 0
Views: 1364
Reputation: 103
Sorted ... Not sure what was the problem, I had to delete node_module folder, remove any pusher related packages and reinstall.
Upvotes: 1