<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                1.修改/web/tool/demo/server/ws.php ``` <?php class Ws { CONST HOST = "0.0.0.0"; CONST PORT = 9501; public $ws = null; public function __construct() { $this->ws = new swoole_websocket_server("0.0.0.0", 9501); $this->ws->set([ 'worker'=>2, 'task_worker_num'=>2, //'enable_static_handler'=>true, //'document_root'=>'/web/tool/demo/html', ]); $this->ws->on("open", [$this, 'onOpen']); $this->ws->on("message", [$this, 'onMessage']); $this->ws->on('task',[$this,'onTask']); $this->ws->on('finish',[$this,'onFinish']); $this->ws->on("close", [$this, 'onClose']); $this->ws->start(); } /** * 監聽ws連接事件 * @param $ws * @param $request */ public function onOpen($ws, $request) { var_dump($request->fd); } /** * 監聽ws消息事件 * @param $ws * @param $frame */ public function onMessage($ws, $frame) { echo "ser-push-message:{$frame->data}\n"; $data = [ 'task'=>1, 'fd'=>$frame->fd, ]; $ws->task($data); $ws->push($frame->fd,"server-push:".date('Y-m-d H:i:s')); } public function onTask($serv,$taskId,$workerId,$data) { print_r($data); sleep(10); return "task finish"; } public function onFinish($serv,$taskId,$data) { echo "taskId:{$taskId}\n"; echo "finish data success:{$data}\n"; } /** * close * @param $ws * @param $fd */ public function onClose($ws, $fd) { echo "clientid:{$fd}關閉\n"; } } $obj = new Ws(); ``` 2.啟動ws.php與http_server.php ![](https://img.kancloud.cn/f2/25/f22548c8a0626b35c5b8898adc7fb375_407x223.png)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看