0

I was trying to catch a fired event on my Web sockets Dashboard but my event is returning [NULL] when fired. Please note that it is only happening in my existing project. I tried doing the same on a fresh Laravel project and it is working just fine. The event returns [] (blank array) when fired and the content of the event gets shown in the Laravel Web sockets dashboard.

Any idea on why it is returning NULL on my existing project? What can possibly be wrong. Below is my Event file (RealTimeMessage.php)

namespace App\Events;

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

class RealTimeMessage implements ShouldBroadcast
{
    use SerializesModels;

    public $message;

    /**
     * Create a new event instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->message = "Hello World";
    }
    
    /**
     * Get the channels the event should broadcast on.
     *
     * @return \Illuminate\Broadcasting\Channel|array
     */
    public function broadcastOn()
    {
        return new Channel('custom-event');
    }
}
Chris
  • 3
  • 1

0 Answers0