9 months ago

Laravel echo events render issue

Posted 9 months ago by Atef95

Hey guys , I'm trying to display event coming from pusher in my vuejs app so I just added this following code in one of my components

 mounted() {

        var channel ='Post');
        channel.listen('event', function()  {


when I refresh the page and check pusher debuger I can see Channel Post occupied.. I send data from there but nothing displays ! no errors in console..

This is my event


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 CreatePost implements ShouldBroadcast
    use Dispatchable, InteractsWithSockets, SerializesModels;

   public $post;

    public function __construct($post)

    public function broadcastOn()
        return new Channel('Post');

    public function broadcastAs()
        return 'event';

Added the code below in bootstrap.js

import Echo from 'laravel-echo'

window.Pusher = require('pusher-js');

window.Echo = new Echo({
    broadcaster: 'pusher',
    key: mykey,
    cluster: 'eu',
    encrypted: true

in my env file I changed broadcast=> pusher

couldn't figure out what's wrong here...

Please sign in or create an account to participate in this conversation.