kossa's avatar
Level 20

Laravel echo: listenForWhisper not working

Hello,

I want to build a simple call between 2 persons on my app, there is a button the the top left, when I click I want to show a popup for the second person without passing by Laravel, for that I'm trying to use whisper

For that I'm using:

  • Laravel 5.6
  • "vue": "^2.5.7"
  • "laravel-echo": "^1.4.0"

On my vue component I have :

created () {
        Echo.private('chat')
            .listenForWhisper('test', (e) => {
                console.log(e); // This line not show anything
            });
    },

    methods: {
        calling () {
            Echo.private('chat')
                .whisper('test', {
                    name: "John"
                });

        } 
    }

When I click on the button calling() was executed and on the dash of pusher I see the event => https://screencast.com/t/0hrsmVRUyx

But the console.log(e) not working

Where is the problem ?

Thank you

0 likes
1 reply
tol64's avatar

Perhaps it's enough to add this code.

routes\channels.php

Broadcast::channel('chat', function ($user) {
    return Auth::check();
});

Please or to participate in this conversation.