jeudi 23 avril 2020

Laravel brodcasting not sending pusher message

I created event that implements shouldBrodcast, on my local machine the web applecation and pusher are working and the event is being executed correclty and I am recieving the API Message, but on other machine it seems that the event is not getting excuted because I recieve nothing and not even an error. should I execute something like php artisan queue:listen or php artisan:work since I am implementing shouldBrodcast not shouldBrodcastNow?.

my event:

<?php

namespace axv\dr\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 msgsnd implements ShouldBroadcast
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    /**
     * Create a new event instance.
     *
     * @return void
     */
    public $msg;
    private $channel_id;

    public function __construct($channel_id, $msg)
    {
        //
        $this->msg = $msg;
        $this->chat_id = $channel_id;

    }

    /**
     * Get the channels the event should broadcast on.
     *
     * @return \Illuminate\Broadcasting\Channel|array
     */
    public function broadcastOn()
    {
        return new Channel('msging-'.$this->channel_id);
    }
}

then I set up route the point to controller function which is:

event(new msgsnd(5, 'hello'));

I did not edit the queue config and also I did not run ```php artisan qeue:listen"

I recieve the event on pusher debug console when using my local machine, but, on the other machine I recieve nothing not even an error.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire