使用redis异步订阅,出现的问题,求大佬指点

报错是这样的
2019-07-03 16:20:53 pid:25979 Worker[25979] process terminated with ERROR: E_COMPILE_ERROR "Declaration of Workerman\Events\React\Base::cancelTimer(React\EventLoop\TimerInterface $timer) must be compatible with React\EventLoop\LoopInterface::cancelTimer(React\EventLoop\Timer\TimerInterface $timer) in /www/wwwroot/ws.hq.dyhjw.com2/vendor/workerman/workerman/Events/React/Base.php on line 22"
2019-07-03 16:20:53 pid:27591 worker[PHPSocketIO:25979] exit with status 65280

服务端代码如下:

// 当$sender_io启动后监听一个http端口,通过这个端口可以给任意uid或者所有uid推送数据
$sender_io->on('workerStart', function(){
global $factory;
$loop = Worker::getEventLoop();
$factory = new Factory($loop);
$factory->createClient('localhost:6379')->then(function (Client $client) {
$client->auth('123456');
$client->subscribe('quotes')->then(function () {
echo 'Now subscribed to channel ';
});
$client->on('message', function ($event_name, $message) {
global $sender_io, $uidConnectionMap;
if ($uidConnectionMap) {
$value = json_decode($message, true);
$data = [
'C' => str_replace("+","",$value['Code']),
'T' => $value['QuoteTime'],
'P' => $value['Last'],
'L' => $value['Low'],
'H' => $value['High'],
'O' => $value['Open'],
'BUY' => $value['Buy'],
'LC' => $value['LastClose'],
//'JS' => $value['LastSettle']?$value['LastSettle']:'',
'ZD' => (string)round($value['Last'] - $value['LastClose'], 2),
'Sell' => $value['Sell'],
'V' => $value['Volume'],
'ZDF' => @(string)round(($value['Last'] - $value['LastClose']) / $value['LastClose'] * 100, 2)
];
// 在编码数组里,就进行发送
$code = $data['C'];
if($code){
//$sender_io->emit('data', $data);
$sender = $sender_io->to($code);
if($sender){
$sender->emit('data', $data);
}
}
}
});
});
});

 
已邀请:

walkor

赞同来自:

recat/redis项目已经过期了,不要再使用了

要回复问题请先登录注册