nuxt-community / laravel-echo-module

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

Can't get event fired from backend #9

Closed andredsnogueira closed 4 years ago

andredsnogueira commented 4 years ago

I'm trying to receive events from Laravel Backend through Redis. Using laravel-echo-server start i can see the events firing from Backend but i am unable to receive on my nuxt application.

As title said when i open the page the socket connection went fine but after that nothing happens. If i'm not wrong in the Chrome Devtools Network tab i should see pooling requests, right?

I'm using socket-io.

Thanks in advance.

halilyuce commented 4 years ago

Same here, everything is fine at laravel side but it seems not working. Also, I`m using socket-io too.

andredsnogueira commented 4 years ago

Same here, everything is fine at laravel side but it seems not working. Also, I`m using socket-io too.

First connection okay and then nothing happens on nuxt-side?

halilyuce commented 4 years ago

@andredsnogueira I solved it ! I discovered after last updates redis added a prefix before channel names. If you configure that prefix by the empty string at config/database.php, it is working. Do not forget to run php artisan cache:clear command too at the end.

'redis => [

        'client' => env('REDIS_CLIENT', 'predis'),

        'options' => [
            'cluster' => env('REDIS_CLUSTER', 'predis'),
            'prefix' => '',
        ],

        'default' => [
            'url' => env('REDIS_URL'),
            'host' => env('REDIS_HOST', '127.0.0.1'),
            'password' => env('REDIS_PASSWORD', null),
            'port' => env('REDIS_PORT', 6379),
            'database' => env('REDIS_DB', 0),
            'prefix' => '',
        ],

        'cache' => [
            'url' => env('REDIS_URL'),
            'host' => env('REDIS_HOST', '127.0.0.1'),
            'password' => env('REDIS_PASSWORD', null),
            'port' => env('REDIS_PORT', 6379),
            'database' => env('REDIS_CACHE_DB', 1),
        ],

    ],
andredsnogueira commented 4 years ago

@andredsnogueira I solved it ! I discovered after last updates redis added a prefix before channel names. If you configure that prefix by the empty string at config/database.php, it is working. Do not forget to run php artisan cache:clear command too at the end.

'redis => [

        'client' => env('REDIS_CLIENT', 'predis'),

        'options' => [
            'cluster' => env('REDIS_CLUSTER', 'predis'),
            'prefix' => '',
        ],

        'default' => [
            'url' => env('REDIS_URL'),
            'host' => env('REDIS_HOST', '127.0.0.1'),
            'password' => env('REDIS_PASSWORD', null),
            'port' => env('REDIS_PORT', 6379),
            'database' => env('REDIS_DB', 0),
            'prefix' => '',
        ],

        'cache' => [
            'url' => env('REDIS_URL'),
            'host' => env('REDIS_HOST', '127.0.0.1'),
            'password' => env('REDIS_PASSWORD', null),
            'port' => env('REDIS_PORT', 6379),
            'database' => env('REDIS_CACHE_DB', 1),
        ],

    ],

It works. I will close this issue.