Private channel not working with Laravel echo server

后端 未结 4 1669
猫巷女王i
猫巷女王i 2021-01-07 07:13

I\'m getting this JS error on the console:

app.js:167 Uncaught ReferenceError: receiverId is not defined

Here is my complete code:

<

4条回答
  •  走了就别回头了
    2021-01-07 07:29

    There are a few things you need to do.

    1) Remove all 'private-' from the beginning of your channel names. These get handled behind the scenes by the various libraries (eg socket.io/laravel-echo). If you look at any debug output you will see 'private-' prepended to the front of the channel names but you DO NOT need to add these.

    2) If you're using redis then make sure the REDIS_PREFIX is set to an empty string in your .env file. By default it's set to something like 'laravel_database' and this messes up the channel names.

    REDIS_PREFIX=
    

    3) Make sure you've got your laravel-echo server running (and redis/pusher). Also you need to make sure you have the queue worker running. In my case, as i;m running redis, i had to run:

    php artisan queue:work redis
    

提交回复
热议问题