报错是这样的
2019-07-03 16:20:53 pid:25979 Worker 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 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 = ;
// 在编码数组里,就进行发送
$code = $data;
if($code){
//$sender_io->emit('data', $data);
$sender = $sender_io->to($code);
if($sender){
$sender->emit('data', $data);
}
}
}
});
});
});
recat/redis项目已经过期了,不要再使用了
好的,谢谢,那我这边应该用什么做替换合适呢