swoole的websocket 部分怎么通知全部在线用户

swoole的websocket 部分怎么通知全部在线用户


冉冉说
浏览 652回答 2
2回答

动漫人物

echo "server: handshake success with fd{$request->fd}\n";$_SESSION['group'][$request->fd]=$request->fd;});$server->on('message', function (swoole_websocket_server $server, $frame) {echo "receive from {$frame->fd}:{$frame->data},opcode:{$frame->opcode},fin:{$frame->finish}\n";$arr=array_unique($_SESSION['group']);$data=json_decode($frame->data,true);if (is_array($arr)){foreach ($arr as $key=>$row){$server->push($row, json_encode(array('name'=>$data['name'],'type'=>$data['type'],'info'=>$data['info'])));}}else{
打开App,查看更多内容
随时随地看视频慕课网APP