Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Laravel 11 and Reverb #82

Open
ssgnoe opened this issue Jul 24, 2024 · 0 comments
Open

Support for Laravel 11 and Reverb #82

ssgnoe opened this issue Jul 24, 2024 · 0 comments

Comments

@ssgnoe
Copy link

ssgnoe commented Jul 24, 2024

Is there a working version for Laravel 11 and Laravel Reverb?
Used beyondcode/laravel-websockets till today and "@nuxtjs/laravel-echo": "2.0.0-alpha.5".
Is there a newer Version which supports Laravel Reverb?
Hoping it is only necessary to update echo.js to a newer Version.

In nuxt 2 I'm using a plugin with this code:

export default async function ($nuxt) {
  if ($nuxt.$echo.options.broadcaster !== $nuxt.$echo.config.broadcaster) {
    $nuxt.$echo.options.broadcaster = $nuxt.$echo.config.broadcaster
    await $nuxt.$echo.connect()
  }
}

and config in build modules which is like

[ '@nuxtjs/laravel-echo', {
      broadcaster: 'reverb',
      key: process.env.PUSHER_APP_KEY,
      wsHost: process.env.PUSHER_HOST,
      wsPort: process.env.PUSHER_PORT,
      wssPort: process.env.PUSHER_PORT,
      forceTLS: false,
      disableStats: true,
      authModule: true,
      connectOnLogin: true,
      disconnectOnLogout: true,
      plugins: [
        '@/plugins/echo',
      ],
      enabledTransports: ['ws', 'wss'],
      authorizer: (channel, options) => {
        return {
            authorize: (socketId, callback) => {
                $nuxt.$axios.post('/api/broadcasting/auth', {
                    socket_id: socketId,
                    channel_name: channel.name
                })
                .then(response => {
                    callback(false, response.data);
                })
                .catch(error => {
                    callback(true, error);
                });
            }
        };
    },

  }]

Getting the following error

ReferenceError: Pusher is not defined
    at PusherConnector.connect (echo.js:1060:27)
    at new Connector (echo.js:974:10)
    at PusherConnector._createSuperInternal (echo.js:129:24)
    at new PusherConnector (echo.js:1039:20)
    at Echo.connect (echo.js:1487:26)
    at Echo._callee3$ (echo.js:39:5)
    at tryCatch (pdf_viewer.js:1329:1)
    at Generator.invoke [as _invoke] (pdf_viewer.js:1502:1)
    at Generator.next (pdf_viewer.js:1372:1)
    at asyncGeneratorStep (asyncToGenerator.js:3:1)

According to docs I think it's not the newest version of echo.js installed?
https://laravel.com/docs/11.x/broadcasting#client-side-installation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant