Search code examples
phplaravellaravel-echo

can't remove laravel_database_ prefix from channel


I'm setting up Laravel echo to broadcast events. But whenever I try to broadcast to a channel the channel name gets an automatic prefix: 'laravel_database_'

I've tried switching the return inside the Event to a regular 'Chanel' as following:

public function broadcastOn()
{
return new Channel('public');
}

but when I look into the laravel-echo-server logs I see it is still being broadcasted on: 'laravel_database_public'.

This way I would need to do the following in my JS:

Echo.channel('laravel_database_public').listen('MessageSent', ({message}) => {
                console.log(message);
            });

But ofcourse, I want to remove the prefix (or figure out why its there). Hopefully someone can clear this up for me. Thanks in advance.


Solution

  • This is configurable in config/database.php (and I believe even removable) under

    'redis' => [
        'options' => [
            'prefix' => // change here.
        ]
    ]