I'm trying to get Pusher to work with my Laravel application. I have a private channel, user is authenticated and connects to it. When I send a test message from Pusher Debug Console, I receive the entry on my client.
I'm having an issue with sending an event to pusher from my L5 app. The event is triggered, and in my L5 log I see the following:
[2017-03-02 13:07:23] local.INFO: Broadcasting [App\Events\xyz] on channels [private-xyz_35] with payload:
{
"message": {
"user": "35",
"code": "KKKK1111"
},
"socket": null
}
My .ENV file and broadcasting config are all configured correctly. When I trigger the event, i don't see an API Message in my Pusher Debug Console.
Can anyone point me out what am I doing wrong here?
This is my event:
<?php
namespace App\Events;
use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
class xyz implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
/**
* Create a new event instance.
*
* @return void
*/
/**
* Only (!) Public members will be serialized to JSON and sent to Pusher
**/
public $message;
public function __construct($message)
{
$this->message = $message;
}
/**
* Get the channels the event should broadcast on.
*
* @return Channel|array
*/
public function broadcastOn()
{
return new PrivateChannel('xyz_' . $this->message['user']);
}
}
via Petar-Krešimir