<?php
/**
 *
 * 推送10秒推送一次
 *
 * @author chenjiebin <sjlinyu@qq.com>
 */

define("APPLICATION_PATH", realpath(dirname(__FILE__) . '/../../../')); //指向public的上一级
require APPLICATION_PATH . '/scripts/crontab/baseCli.php';
require APPLICATION_PATH . '/scripts/crontab/common.php';
error_reporting(E_ALL ^ E_NOTICE);
// redis 没有设置密码
$conf = \Yaf\Registry::get('config')->get('redis.database.params');
$redis=new Redis();
$redis->connect($conf['host'], $conf['port']);
if(!empty($conf['password'])){
    $redis->auth($conf['password']);
}
//ini_set('default_socket_timeout', -1);(所有长连接不超时)
$redis->setOption(Redis::OPT_READ_TIMEOUT, -1);
$result=$redis->subscribe(array('redisPublish'), 'callback');
function printTest($meg){
    echo $meg.'213';
}
function callback($instance,$channelName,$message){
    if($message=='outPid'){
        $instance->unsubscribe(array($channelName));
        return;
    }
    printTest($message);
}
