jeudi 22 juin 2017

Laravel Pusher channel returns empty array

So I have this piece of code that uses Pusher in Laravel for event broadcasting. But when I excute the code it returns empty array in both laravel route and pusher console.

Event

namespace App\Events;

use Illuminate\Queue\SerializesModels;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;


use Illuminate\Broadcasting\Channel;
class ProjectEvent implements ShouldBroadcast
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    public $username;

    public $message;

    /**
     * Create a new event instance.
     *
     * @return void
     */
    public function __construct($user)
    {
       // $this->username = $user;
        $this->message  = $user;
    }

    /**
     * Get the channels the event should broadcast on.
     *
     * @return Channel|array
     */
    public function broadcastOn()
    {
        return ['project-update'];
    }
}

Route:

Route::get('/test', function () {
    return event(new App\Events\ProjectEvent('Michel'));
    //return "Event has been sent!";
});

Broadcasting configuration

'default' => env('BROADCAST_DRIVER'),

    'connections' => [

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

I don't know if I'm leaving something out here. With all this if I access http://ift.tt/1cCTjyM All I get is []

And this is the pusher console

Pusher : Event recd : {"event":"pusher_internal:subscription_succeeded","data":{},"channel":"project-update"}



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2svbHEl
via IFTTT

Aucun commentaire:

Enregistrer un commentaire