mardi 1 août 2017

Laravel Spark not sending message to Pusher from event

Trying to get Pusher working on my app but cannot get it to send any messages to Pusher itself.

I have an event that is fired when creating a 'booking':

event(new BookingCreated($booking));

This event:

<?php

namespace App\Events\Booking;

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

class BookingCreated implements ShouldBroadcast
{
    use SerializesModels, InteractsWithSockets;

    public $booking;

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

    public function broadcastOn()
    {
        return ['teams.'.$this->booking->team_id.'.bookings'];
    }
}

My env file has the following (with details):

BROADCAST_DRIVER=pusher
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=

My broadcasting config file has the pusher details set up as:

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

When looking in the Pusher dashboard I can see open connections, but no messages. I am running queue:listen which is showing that the events are being processed.

Anything I am missing?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire