tlaverdure / laravel-echo-server

Socket.io server for Laravel Echo
MIT License
2.65k stars 510 forks source link

Redis keyPrefix does not work #562

Open violarium opened 3 years ago

violarium commented 3 years ago

Redis prefix does nothing

laravel-echo-server version: 1.6.2

laravel-echo-server.json:

{
    "authHost": "http://localhost:8087",
    "authEndpoint": "/broadcasting/auth",
    "clients": [
    ],
    "database": "redis",
    "databaseConfig": {
        "redis": {
            "port": "16378",
            "host": "localhost",
            "keyPrefix": "my-redis-prefix"
        },
        "sqlite": {
            "databasePath": "/database/laravel-echo-server.sqlite"
        }
    },
    "devMode": true,
    "host": null,
    "port": "6001",
    "protocol": "http",
    "socketio": {},
    "secureOptions": 67108864,
    "sslCertPath": "",
    "sslKeyPath": "",
    "sslCertChainPath": "",
    "sslPassphrase": "",
    "subscribers": {
        "http": true,
        "redis": true
    },
    "apiOriginAllow": {
        "allowCors": false,
        "allowOrigin": "",
        "allowMethods": "",
        "allowHeaders": ""
    }
}

Events still are: Снимок экрана от 2021-03-09 14-14-10

ManuDoni commented 3 years ago

Hi, if you are still having the issue I can help because I had the same problem. IMHO This depends on the Laravel configuration.

If don't have a Redis prefix isn't an issue for you, try to insert this in your Laravel .env file:

#leave REDIS_PREFIX empty but present or the laravel-echo client won't work
REDIS_PREFIX=

I removed the prefix because laravel-echo-client creates a channel string putting the prefix in the wrong place. This causes a mismatch between the channel name used by the client and the one used by the server.