php - Unable to Subscribe to Redis Channel Laravel 5.2 -
i following laravel office redis guide having problem https://laravel.com/docs/5.2/redis#pubsub
after creating command when run " -> php artisan redis:subscribe" in console following error
[symfony\component\console\exception\commandnotfoundexception] there no commands defined in "redis" namespace.
i unable listen redis chanel.
redis publish channel method working fine. check this. in console typed "-> redis-cli" , "subscribe mychannel" on refreshing browser getting publish data in console.
i unable subscribe via laravel.
i tried using wild card
route::get('/subscribe', function() { redis::psubscribe(['*'], function($message, $channel) { echo $message; }); });
but browser keep loading , don't data. tried making 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 string, array given
my configuration in config/database.php 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 thanks
Comments
Post a Comment