I am following Laravel office Redis guide but i am having some problem https://laravel.com/docs/5.2/redis#pubsub
After creating the command when i run " -> php artisan redis:subscribe" in console i get following error
[Symfony\Component\Console\Exception\CommandNotFoundException]
There are no commands defined in the "redis" namespace.
I am unable to listen to Redis Chanel.
Redis Publish Channel method is working fine. To check this. In console I typed "-> redis-cli" and then "subscribe mychannel" On refreshing browser I am getting publish data in console.
I am unable to subscribe via Laravel.
I also tried using wild card
Route::get('/subscribe', function()
{
Redis::psubscribe(['*'], function($message, $channel) {
echo $message;
});
});
but browser keep loading and i don't get any data. I also tried making a method in controller
public function subscribeChannel()
{
$redis = Redis::Connection();
$redis->subscribe(['channel'], function($message) {
echo $message;
});
}
This subscribeChannel method gives me following error
ErrorException in StreamConnection.php line 390:
strlen() expects parameter 1 to be string, array given
My configuration in config/database.php is folowing
'redis' => [
'cluster' => false,
'default' => [
'host' => env('REDIS_HOST', 'localhost'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => 0,
'read_write_timeout' => 0
],
],
Looking for help thanks