nuxt-community / laravel-echo-module

Laravel Echo for Nuxt 2
MIT License
85 stars 32 forks source link

Using private channels #12

Closed farazappy closed 4 years ago

farazappy commented 4 years ago

Hey,

I couldn't find anything about using private channels, is it supported.

According to Laravel Docs, in Echo we can do something like : Echo.private('App.User.${userId}') .notification((notification) => { console.log(notification.type); });

But when I use this.$echo.private...something similar It isn't subscribing to the Private Channel.

What am I missing here?

ricardogobbosouza commented 4 years ago

Hi @farazappy To use private channels, you need:

export default {
  echo: {
    broadcaster: 'pusher',
    key: '48a97e3feef8c4e454bf',
    authModule: true // enable auth module,
    authEndpoint: 'endpoint' // https://laravel.com/docs/7.x/broadcasting#defining-authorization-routes
  }
}

:warning: You must have an authenticated user