src/WorkerF/DB/Redis.php
public static function subscribe($channels, Closure $callback, $connection = 'default', $method = 'subscribe')
    {
        $loop = self::$_clients[$connection]->pubSubLoop();

        call_user_func_array([$loop, $method], (array) $channels);

        // loop blocking, start listen redis publish messages
        foreach ($loop as $message) {
            if ($message->kind === 'message' || $message->kind === 'pmessage') {
                // get publish message
                call_user_func($callback, $message->payload, $message->channel);
            }
        }
        // unset Predis\PubSub\Consumer iterator
        unset($loop);
    }
public static function subscribe($channels, Closure $callback, $connection = 'default', $method = 'subscribe')
    {
        $loop = self::$_clients[$connection]->pubSubLoop();

        call_user_func_array([$loop, $method], (array) $channels);

        // loop blocking, start listen redis publish messages
        foreach ($loop as $message) {
            if ($message->kind === 'message' || $message->kind === 'pmessage') {
                // get publish message
                call_user_func($callback, $message->payload, $message->channel);
            }
        }
        // unset Predis\PubSub\Consumer iterator
        unset($loop);
    }
Subscribe to a set of given channels for messages.
'read_write_timeout' => 0 to solve the timeout problem

@param  array|string  $channels
@param  \Closure  $callback
@param  string  $connection
@param  string  $method
@return void