tlaverdure / laravel-echo-server

Socket.io server for Laravel Echo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Subcription to private channel with Pusher and Echo

remif25 opened this issue · comments

Hi,

I am not sur if it's a bug or a misundestanding from myself but I got trouble to listen event on a private channel wih Echo because it was not clear how i should use Echo.
In the code above only the second is trigger when I send a event from Pusher. Is it normal ? Did I miss something ? Why others doesn't work ?

window.Echo = new Echo({
    broadcaster: 'pusher',
    key: process.env.MIX_PUSHER_APP_KEY,
    cluster: process.env.MIX_PUSHER_APP_CLUSTER,
    forceTLS: true,
});

const channel = window.Echo.private('App.Room.1');

window.Echo.private('App.Room.1')
    .listen('new-message', function(e) {
        console.log("1");
});
window.Echo.listen('private-App.Room.1', '.new-message', (e) => {
    console.log("2");
});
channel.listen('new-message',function(e) {
    console.log("3");
});
channel.listen('private-App.Room.1', '.new-message', (e) => {
    console.log("4");
});

Tell me if you need more informations.
Thank you.

This package seems to be abandoned. I have initially forked the app, but I found out how inefficient is Socket.IO, and managed to create an open-source Pusher alternative (that doesn't require Pusher credentials) that can be deployed anywhere for free. This does require the driver to be switched from Socket.IO to Pusher. Not sure if it helps, but I wanted to spread the word about it. 😁 Read more about it here.