Good day! I use PrecenseChannel and I catch join / leave on server side using a subscription to the Redis channel I use artisan command:
public function handle()
{
$this->info("Presence channel watcher was started!");
Redis::subscribe(['PresenceChannelUpdated'] , function ($message, $channel) {
//Code for comparing users who leave and who join
Notification::send($a1->users, new ExampleNotification($a2, $data));
}
}
I use notification for send event (only broadcast) But after sending Notification I get an error in console:
ERR only (P)SUBSCRIBE / (P)UNSUBSCRIBE / PING / QUIT allowed in this contex
Without notification, everything works and the notification itself works and sends broadcast
Since I use these notifications in the Services, therefore, the notification works
Any help? Thanks
Solution: Go to php.ini and set:
default_socket_timeout = -1
And add connection for Redis
Redis::connection('subscriber')->subscribe(['PresenceChannelUpdated'], callback)