nuxt-community / laravel-echo-module

Laravel Echo for Nuxt 2
MIT License
86 stars 31 forks source link

Problem with connectors and authModule #51

Closed alitnk closed 2 years ago

alitnk commented 3 years ago

package.json:

"@nuxtjs/laravel-echo": "^2.0.0-alpha.5",
"nuxt": "^2.14.12",
"@nuxtjs/auth-next": "5.0.0-1613647907.37b1156",
"pusher-js": "^7.0.3",

nuxt.config.js:

buildModules: [
    ...
    '@nuxtjs/laravel-echo',
  ],
modules: [
    ...
    '@nuxtjs/auth-next',
  ],
echo: {
    ...
    broadcaster: 'pusher',
    authModule: true,
}

My connector is set to NullConnector when I set authModule to true, But when I set it back to false, it's a PusherConnectoragain. Any idea?

alitnk commented 3 years ago

Apparently, when I set connectOnLogin to false, I get the correct Connector.

pleasemic commented 3 years ago

@alitnk , Same problem...

package.json:

"nuxt": "^2.15.4",
"@nuxtjs/auth-next": "^5.0.0-1616003482.75c20e6",
"@nuxtjs/laravel-echo": "^2.0.0-alpha.5",
"socket.io": "^2.4.0",
"socket.io-client": "^2.4.0",

Using "socket.io" broadcaster with socket.io > 2.4.0 version this module doesn't work (messages from server are not recieved).

nuxt.config.js:

buildModules: [
    ...
    '@nuxtjs/laravel-echo',
],
modules: [
    ...
    '@nuxtjs/auth-next',
],
echo:{
      broadcaster: 'socket.io',
      host: 'https://mysite.com:6001',
      authModule: false,
      //authEndpoint: ...
      //connectOnLogin: ...
      //disconnectOnLogout: ...
},

If I try to change authModule value to true, messages from the server are not receiving, console is clear. May be I should set one of these options:

//authEndpoint: ...
//connectOnLogin: ...
//disconnectOnLogout: ...

Expected to see at least errors in the console...

mohsenMJ commented 3 years ago

I have the same error

"@nuxtjs/laravel-echo": "^2.0.0-alpha.5",
"nuxt": "^2.14.12",
"@nuxtjs/auth-next": "^5.0.0-1617968180.f699074",
"socket.io-client": "^4.0.1"

I am connected to server but can't subscribe to any channel (private or public) so I can't receive any message.

this.$echo.private('App.Models.User.' + this.$auth.user.id)
            .notification((e) => console.log('received notifications ', e));

I am logged In , please help !!

mohsenMJ commented 3 years ago

is there anyone that could listen to this Issues!!!

nuxtjs larave-echo

connection to the server from socket client is successful but I can't subscribe to any channel!

please help

devzom commented 3 years ago

Unlucky same issue. That's why have to implement subscribe/connect to private user channel on every Nuxt vuex initStore

devzom commented 2 years ago

@alitnk , Same problem...

package.json:

"nuxt": "^2.15.4",
"@nuxtjs/auth-next": "^5.0.0-1616003482.75c20e6",
"@nuxtjs/laravel-echo": "^2.0.0-alpha.5",
"socket.io": "^2.4.0",
"socket.io-client": "^2.4.0",

You don't need the socket.io package, just the socket.io-client

- Use maxium version 2.4.0 of socket.io-client

@mohsenMJ @hmsk is there anyone that could listen to this Issues!!!

connection to the server from socket client is successful but I can't subscribe to any channel!

please help

looks like there's no issue with the laravel-echo but with the naming of channel or events from Your backend .

I've found that there was a collision in naming, I was trying to access event this way ThreadCreated but the correct way was to add a dot . before the name to be .ThreadCreated and it does work. Look into documentation https://laravel.com/docs/7.x/broadcasting#broadcast-name

starofsky commented 2 years ago

@alitnk I think you can try with solution from https://github.com/nuxt-community/laravel-echo-module/issues/56 @mohsenMJ you can try downgrade "socket.io-client": "^2.4.0" which use EIO version 3