$con = new AsyncTcpConnection('ws://106.52.xx.xx:9001');
$con->connect();
$con->onConnect = function($con) use($objJob){
$strcontent = json_encode($objJob);
worker::log('contents:'.$strcontent);
$con->send($strcontent);
};
$con->onMessage = function($con, $data) {
worker::log($data);
};
$con->onError = function ($con, $code, $msg){
worker::log($msg);
};
在一个worker里面定时检查是否有新数据到达(用redis的阻塞等待),有的话通知websocket服务器,这样的用法好像不行,websocket服务没收到数据。
还有就是如果要主动发送,怎么做呢?
估计是redis阻塞导致的