for($i=0;$i<=count($arr)-1;$i++){
?
$uid = $arr->device_id;
$command = $arr->command;
$GLOBALS = Timer::add($arr->frequency, function()use($command ){
Gateway::sendToAll(stripcslashes($command));
});
usleep(200000);
?
}
使用以上代碼向同一客戶端發(fā)送消息,初始時(shí)間間隔是每條消息200ms,但運(yùn)行半小時(shí)左右時(shí),會(huì)出現(xiàn)部分消息發(fā)送的時(shí)間間隔消失,導(dǎo)致數(shù)據(jù)不能按間隔接收處理,請(qǐng)大神們幫忙看看問(wèn)題出在哪里,謝謝!