Skip to content

Support for Laravel 11 and Reverb #82

Open
@ssgnoe

Description

@ssgnoe

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions