{"id":81165,"date":"2026-07-25T00:12:17","date_gmt":"2026-07-24T16:12:17","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/81165.html"},"modified":"2026-07-25T00:12:17","modified_gmt":"2026-07-24T16:12:17","slug":"%e9%a1%b9%e7%9b%ae%e7%af%87%ef%bc%9a%e6%9c%8d%e5%8a%a1%e5%99%a8%e6%a8%a1%e5%9d%97%e5%8f%8a%e5%ae%a2%e6%88%b7%e7%ab%af%e7%9a%84%e8%ae%be%e8%ae%a1%e4%b8%8e%e5%ae%9e%e7%8e%b0","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/81165.html","title":{"rendered":"\u9879\u76ee\u7bc7\uff1a\u670d\u52a1\u5668\u6a21\u5757\u53ca\u5ba2\u6237\u7aef\u7684\u8bbe\u8ba1\u4e0e\u5b9e\u73b0"},"content":{"rendered":"<h2 style=\"background-color:transparent\">\u00a0 \u00a0 \u00a0 \u00a0 1.\u901a\u4fe1\u63a5\u53e3\u8bbe\u8ba1<\/h2>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u670d\u52a1\u5668\u6a21\u5757\u662f\u5bf9\u5f53\u524d\u6240\u6709\u5df2\u7ecf\u5b9e\u73b0\u7684\u6a21\u5757\u7684\u4e00\u4e2a\u6574\u5408&#xff0c;\u5e76\u8fdb\u884c\u670d\u52a1\u7684\u6a21\u5757\u3002\u4f7f\u7528websocket\u5e93\u7684\u63a5\u53e3\u6765\u642d\u5efa\u670d\u52a1\u5668\u7684\u57fa\u672c\u67b6\u6784&#xff0c;\u518d\u5b9e\u73b0\u56db\u4e2a\u4e3b\u8981\u7684\u63a5\u53e3&#xff1a;http\u8bf7\u6c42\u7684\u63a5\u53e3&#xff0c;\u5efa\u7acbwebsocket\u94fe\u63a5\u8bf7\u6c42&#xff0c;\u65ad\u5f00websocket\u94fe\u63a5\u8bf7\u6c42&#xff0c;websocket\u901a\u4fe1\u8bf7\u6c42\u3002<\/p>\n<h3>\u00a0 \u00a0 \u00a0 \u00a0 1.1http\u8bf7\u6c42\u63a5\u53e3<\/h3>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u7528\u6237\u5728\u672a\u5efa\u7acbwebsocket\u957f\u8fde\u63a5\u5728\u524d\u9700\u8981\u901a\u8fc7http\u8fdb\u884c\u901a\u4fe1&#xff0c;\u7528\u6237\u7684\u8bf7\u6c42\u4e00\u5171\u5206\u4e3a&#xff1a;\u8bf7\u6c42\u9759\u6001\u8d44\u6e90\u3001\u6ce8\u518c\u7528\u6237\u3001\u7528\u6237\u767b\u5f55&#xff0c;\u5728\u7528\u6237\u767b\u5f55\u6210\u529f\u4e4b\u540e\u5c31\u9700\u8981\u83b7\u53d6\u6e38\u620f\u5927\u5385\u7684\u9875\u9762\u4ee5\u53ca\u7528\u6237\u4fe1\u606f\u548c\u5efa\u7acb\u6e38\u620f\u5927\u5385\u7684\u957f\u8fde\u63a5\u3002\u5176\u4e2d\u8bf7\u6c42\u9759\u6001\u8d44\u6e90\u53ea\u9700\u8981\u8fd4\u56de\u9875\u9762\u4fe1\u606f\u5373\u53ef&#xff0c;\u800c\u6ce8\u518c\u767b\u5f55\u4ee5\u53ca\u83b7\u53d6\u7528\u6237\u4fe1\u606f\u90fd\u9700\u8981\u8bbf\u95ee\u6570\u636e\u5e93\u3002<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u5176\u4e2d\u8bf7\u6c42\u548c\u54cd\u5e94\u7684\u65b9\u5f0f\u5982\u4e0b\u3002<\/p>\n<p>. \u6ce8\u518c\u2eda\u2faf\u8bf7\u6c42<br \/>\n \u8bf7\u6c42&#xff1a;GET \/register.html HTTP\/1.1<br \/>\n \u54cd\u5e94&#xff1a;<br \/>\n HTTP\/1.1 200 OK<br \/>\n Content-Length: xxx<br \/>\n Content-Type: text\/html<\/p>\n<p> register.html\u2f42\u4ef6\u7684\u5185\u5bb9\u6570\u636e<\/p>\n<p> 2. \u767b\u5f55\u2eda\u2faf\u8bf7\u6c42<br \/>\n \u8bf7\u6c42&#xff1a;GET \/login.html HTTP\/1.1<br \/>\n 3. \u2f24\u5385\u2eda\u2faf\u8bf7\u6c42<br \/>\n \u8bf7\u6c42&#xff1a;GET \/game_hall.html HTTP\/1.1<br \/>\n 4. \u623f\u95f4\u2eda\u2faf\u8bf7\u6c42<br \/>\n \u8bf7\u6c42&#xff1a;GET \/game_room.html HTTP\/1.1<\/p>\n<p>\/\/\u6ce8\u518c\u7528\u6237\u8bf7\u6c42<br \/>\nPOST \/reg HTTP\/1.1<br \/>\n Content-Type: application\/json<br \/>\n Content-Length: 32<\/p>\n<p> {&#034;username&#034;:&#034;xiaobai&#034;, &#034;password&#034;:&#034;123123&#034;}<br \/>\n #\u6210\u529f\u65f6\u7684\u54cd\u5e94<br \/>\n HTTP\/1.1 200 OK<br \/>\n Content-Type: application\/json<br \/>\n Content-Length: 15<\/p>\n<p> {&#034;result&#034;:true}<\/p>\n<p> #\u5931\u8d25\u65f6\u7684\u54cd\u5e94<br \/>\n HTTP\/1.1 400 Bad Request<br \/>\n Content-Type: application\/json<br \/>\n Content-Length: 43<\/p>\n<p> {&#034;result&#034;:false, &#034;reason&#034;: &#034;\u2f64\u6237\u540d\u5df2\u7ecf\u88ab\u5360\u2f64&#034;}<\/p>\n<p>\/\/\u7528\u6237\u767b\u5f55\u8bf7\u6c42<\/p>\n<p>POST \/login HTTP\/1.1<br \/>\n Content-Type: application\/json<br \/>\n Content-Length: 32<\/p>\n<p> {&#034;username&#034;:&#034;xiaobai&#034;, &#034;password&#034;:&#034;123123&#034;}<br \/>\n #\u6210\u529f\u65f6\u7684\u54cd\u5e94<br \/>\n HTTP\/1.1 200 OK<br \/>\n Content-Type: application\/json<br \/>\n Content-Length: 15<\/p>\n<p> {&#034;result&#034;:true}<\/p>\n<p> #\u5931\u8d25\u65f6\u7684\u54cd\u5e94<br \/>\n HTTP\/1.1 400 Bad Request<br \/>\n Content-Type: application\/json<br \/>\n Content-Length: 43<\/p>\n<p> {&#034;result&#034;:false, &#034;reason&#034;: &#034;\u2f64\u6237\u540d\u6216\u5bc6\u7801\u9519\u8bef&#034;}<\/p>\n<p>\/\/\u83b7\u53d6\u7528\u6237\u4fe1\u606f\u8bf7\u6c42<br \/>\nGET \/userinfo HTTP\/1.1<br \/>\n Content-Type: application\/json<br \/>\n Content-Length: 0<br \/>\n #\u6210\u529f\u65f6\u7684\u54cd\u5e94<br \/>\n HTTP\/1.1 200 OK<br \/>\n Content-Type: application\/json<br \/>\n Content-Length: 58<\/p>\n<p> {&#034;id&#034;:1, &#034;username&#034;:&#034;xiaobai&#034;, &#034;score&#034;:1000, &#034;total_count&#034;:4, &#034;win_count&#034;:2}<\/p>\n<p> #\u5931\u8d25\u65f6\u7684\u54cd\u5e94<br \/>\n HTTP\/1.1 401 Unauthorized<br \/>\n Content-Type: application\/json<br \/>\n Content-Length: 43<\/p>\n<p> {&#034;result&#034;:false, &#034;reason&#034;: &#034;\u2f64\u6237\u8fd8\u672a\u767b\u5f55&#034;} <\/p>\n<h3>\u00a0 \u00a0 \u00a0 \u00a0 1.2websocket\u957f\u8fde\u63a5\u5efa\u7acb\u548c\u5173\u95ed\u8bf7\u6c42<\/h3>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u56e0\u4e3awebsocket\u957f\u8fde\u63a5\u662f\u57fa\u4e8e\u9875\u9762\u7684&#xff0c;\u9875\u9762\u5173\u95ed\u94fe\u63a5\u5c31\u4f1a\u65ad\u5f00&#xff0c;\u6240\u4ee5\u8fdb\u5165\u65e0\u8bba\u662f\u5efa\u7acb\u94fe\u63a5\u8fd8\u662f\u5173\u95ed\u94fe\u63a5\u90fd\u9700\u8981\u533a\u5206\u662f\u6e38\u620f\u623f\u95f4\u7684\u8bf7\u6c42\u8fd8\u662f\u6e38\u620f\u5927\u5385\u7684\u8bf7\u6c42\u3002<\/p>\n<p>\/\/websocket\u957f\u8fde\u63a5\u534f\u8bae\u5207\u6362\u8bf7\u6c42(\u8fdb\u5165\u6e38\u620f\u5927\u5385)<br \/>\n\/* ws:\/\/localhost:9000\/hall *\/<br \/>\n GET \/hall HTTP\/1.1<br \/>\n Connection: Upgrade<br \/>\n Upgrade: WebSocket<br \/>\n &#8230;&#8230;<br \/>\n HTTP\/1.1 101 Switching<br \/>\n &#8230;&#8230;<br \/>\n\/\/WebSocket\u63e1\u2f3f\u6210\u529f\u540e\u7684\u56de\u590d&#xff1a;\u8868\u2f70\u6e38\u620f\u2f24\u5385\u5df2\u7ecf\u8fdb\u2f0a\u6210\u529f\u3002<br \/>\n {<br \/>\n &#034;optype&#034;: &#034;hall_ready&#034;,<br \/>\n &#034;uid&#034;: 1<br \/>\n }<\/p>\n<p>\/\/websocket\u957f\u8fde\u63a5\u534f\u8bae\u5207\u6362\u8bf7\u6c42(\u8fdb\u5165\u6e38\u620f\u623f\u95f4)<br \/>\n\/* ws:\/\/localhost:9000\/room *\/<br \/>\n GET \/room HTTP\/1.1<br \/>\n Connection: Upgrade<br \/>\n Upgrade: WebSocket<br \/>\n &#8230;&#8230;<br \/>\n HTTP\/1.1 101 Switching<br \/>\n &#8230;&#8230;<br \/>\n\/\/WebSocket\u63e1\u2f3f\u6210\u529f\u540e\u7684\u56de\u590d&#xff1a;\u8868\u2f70\u6e38\u620f\u623f\u95f4\u5df2\u7ecf\u8fdb\u2f0a\u6210\u529f\u3002<br \/>\n \/*\u534f\u8bae\u5207\u6362\u6210\u529f&#xff0c; \u623f\u95f4\u5df2\u7ecf\u5efa\u2f74*\/<br \/>\n {<br \/>\n &#034;optype&#034;: &#034;room_ready&#034;,<br \/>\n &#034;room_id&#034;: 222, \/\/\u623f\u95f4ID<br \/>\n &#034;self_id&#034;: 1, \/\/\u2f83\u2f9dID<br \/>\n &#034;white_id&#034;: 1, \/\/\u2f69\u68cbID<br \/>\n &#034;black_id&#034;: 2, \/\/\u2fca\u68cbID<br \/>\n } <\/p>\n<h3>\u00a0 \u00a0 \u00a0 \u00a0 1.3websocket\u901a\u4fe1<\/h3>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 websocket\u901a\u4fe1\u53c8\u53c8\u5206\u4e3a\u6e38\u620f\u5927\u5385\u7684\u8bf7\u6c42\u548c\u6e38\u620f\u623f\u95f4\u7684\u8bf7\u6c42&#xff0c;\u6e38\u620f\u5927\u5385\u7684\u8bf7\u6c42\u6709&#xff1a;\u5f00\u59cb\u5339\u914d\u3001\u53d6\u6d88\u5339\u914d&#xff0c;\u6e38\u620f\u623f\u95f4\u7684\u8bf7\u6c42\u6709&#xff1a;\u4e0b\u68cb\u3001\u804a\u5929\u3002\u6e38\u620f\u623f\u95f4\u7684\u8bf7\u6c42\u5728\u6210\u529f\u5b8c\u6210\u540e\u8fd8\u9700\u8981\u5e7f\u64ad\u7ed9\u623f\u95f4\u5185\u7684\u6240\u6709\u73a9\u5bb6\u3002<\/p>\n<p>\/\/\u2f9b\u68cb<br \/>\n {<br \/>\n &#034;optype&#034;: &#034;put_chess&#034;, \/\/ put_chess\u8868\u2f70\u5f53\u524d\u8bf7\u6c42\u662f\u4e0b\u68cb\u64cd\u4f5c<br \/>\n &#034;room_id&#034;: 222, \/\/ room_id \u8868\u2f70\u5f53\u524d\u52a8\u4f5c\u5c5e\u4e8e\u54ea\u4e2a\u623f\u95f4<br \/>\n &#034;uid&#034;: 1, \/\/ \u5f53\u524d\u7684\u4e0b\u68cb\u64cd\u4f5c\u662f\u54ea\u4e2a\u2f64\u2f3e\u53d1\u8d77\u7684<br \/>\n &#034;row&#034;: 3, \/\/ \u5f53\u524d\u4e0b\u68cb\u4f4d\u7f6e\u7684\u2f8f\u53f7<br \/>\n &#034;col&#034;: 2 \/\/ \u5f53\u524d\u4e0b\u68cb\u4f4d\u7f6e\u7684\u5217\u53f7<br \/>\n }<br \/>\n {<br \/>\n &#034;optype&#034;: &#034;put_chess&#034;,<br \/>\n &#034;result&#034;: false<br \/>\n &#034;reason&#034;: &#034;\u2f9b\u68cb\u5931\u8d25\u5177\u4f53\u539f\u56e0&#8230;.&#034;<br \/>\n }<br \/>\n {<br \/>\n &#034;optype&#034;: &#034;put_chess&#034;,<br \/>\n &#034;room_id&#034;: 222,<br \/>\n &#034;uid&#034;: 1,<br \/>\n &#034;row&#034;: 3,<br \/>\n &#034;col&#034;: 2,<br \/>\n &#034;result&#034;: true,<br \/>\n &#034;reason&#034;: &#034;\u5bf9\u2f45\u6389\u7ebf&#xff0c;\u4e0d\u6218\u2f7d\u80dc&#xff01;&#034; \/ &#034;\u5bf9\u2f45\/\u2f30\u2f45\u4e94\u661f\u8fde\u73e0&#xff0c;\u6218\u2f46\u654c\/\u867d\u8d25\u72b9\u8363&#xff01;&#034;,<br \/>\n &#034;winner&#034;: 0 \/\/ 0-\u672a\u5206\u80dc\u8d1f&#xff0c; !0-\u5df2\u5206\u80dc\u8d1f (uid\u662f\u8c01&#xff0c;\u8c01\u5c31\u8d62\u4e86)<br \/>\n }<br \/>\n\/\/ \u804a\u5929<br \/>\n {<br \/>\n &#034;optype&#034;: &#034;chat&#034;,<br \/>\n &#034;room_id&#034;: 222,<br \/>\n &#034;uid&#034;: 1,<br \/>\n &#034;message&#034;: &#034;\u8d76\u7d27\u70b9&#034;<br \/>\n }<br \/>\n {<br \/>\n &#034;optype&#034;: &#034;chat&#034;,<br \/>\n &#034;result&#034;: false<br \/>\n &#034;reason&#034;: &#034;\u804a\u5929\u5931\u8d25\u5177\u4f53\u539f\u56e0&#8230;.\u2f50\u5982\u6709\u654f\u611f\u8bcd&#8230;&#034;<br \/>\n }<br \/>\n {<br \/>\n &#034;optype&#034;: &#034;chat&#034;,<br \/>\n &#034;result&#034;: true,<br \/>\n &#034;room_id&#034;: 222,<br \/>\n &#034;uid&#034;: 1,<br \/>\n &#034;message&#034;: &#034;\u8d76\u7d27\u70b9&#034;<br \/>\n } <\/p>\n<h2>\u00a0 \u00a0 \u00a0 \u00a0 2.\u670d\u52a1\u5668\u7684\u5177\u4f53\u5b9e\u73b0<\/h2>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u5177\u4f53\u5982\u4e0b\u3002<\/p>\n<p>#ifndef __M_SERVER_H__<br \/>\n#define __M_SERVER_H__<br \/>\n#include &#034;room.hpp&#034;<br \/>\n#include &#034;matcher.hpp&#034;<br \/>\n#include &#034;session.hpp&#034;<\/p>\n<p>#define WWWROOT &#034;.\/wwwroot&#034;<br \/>\nclass gobang_server<br \/>\n{<br \/>\nprivate:<br \/>\n    websocket_server _wssrv;<br \/>\n    std::string _web_root;<br \/>\n    user_table _ut;<br \/>\n    online_manage _om;<br \/>\n    session_manage _sm;<br \/>\n    room_manage _rm;<br \/>\n    match _mm;<\/p>\n<p>private:<br \/>\n    void file_handler(websocket_server::connection_ptr &amp;conn)<br \/>\n    {<br \/>\n        websocketpp::http::parser::request req &#061; conn-&gt;get_request();<br \/>\n        std::string method &#061; req.get_method();<br \/>\n        std::string uri &#061; req.get_uri();<br \/>\n        std::string pathname &#061; _web_root &#043; uri;<br \/>\n        if (uri &#061;&#061; &#034;\/&#034;)<br \/>\n        {<br \/>\n            pathname &#043;&#061; &#034;auth.html&#034;;<br \/>\n        }<br \/>\n        std::string body;<br \/>\n        bool ret &#061; file_util::read(pathname, body);<br \/>\n        if (ret &#061;&#061; false)<br \/>\n        {<br \/>\n            body.clear();<br \/>\n            std::string x &#061; _web_root &#043; &#034;404.html&#034;;<br \/>\n            file_util::read(x, body);<br \/>\n            conn-&gt;set_status(websocketpp::http::status_code::not_found);<br \/>\n        }<br \/>\n        else<br \/>\n        {<br \/>\n            conn-&gt;set_status(websocketpp::http::status_code::ok);<br \/>\n        }<br \/>\n        conn-&gt;set_body(body);<br \/>\n    }<br \/>\n    void login(websocket_server::connection_ptr &amp;conn)<br \/>\n    {<br \/>\n        websocketpp::http::parser::request req &#061; conn-&gt;get_request();<br \/>\n        Json::Value login_json;<br \/>\n        \/\/ \u83b7\u53d6\u6b63\u6587<br \/>\n        std::string req_body &#061; conn-&gt;get_request_body();<br \/>\n        \/\/ \u53cd\u5e8f\u5217\u5316\u5f97\u5230\u7528\u6237\u540d\u548c\u5bc6\u7801<br \/>\n        bool ret &#061; json_util::Unserialization(req_body, login_json);<br \/>\n        if (ret &#061;&#061; false)<br \/>\n        {<br \/>\n            DLOG(&#034;\u53cd\u5e8f\u5217\u5316\u5931\u8d25&#034;);<br \/>\n            return http_resp(false, websocketpp::http::status_code::bad_request, &#034;\u8bf7\u6c42\u683c\u5f0f\u9519\u8bef&#xff01;&#034;, conn);<br \/>\n        }<br \/>\n        if (login_json[&#034;username&#034;].isNull() || login_json[&#034;password&#034;].isNull())<br \/>\n        {<br \/>\n            DLOG(&#034;\u7528\u6237\u63d0\u4ea4\u4fe1\u606f\u4e0d\u5b8c\u5168&#034;);<br \/>\n            return http_resp(false, websocketpp::http::status_code::bad_request, &#034;\u8bf7\u8f93\u5165\u7528\u6237\u540d\/\u5bc6\u7801&#xff01;&#034;, conn);<br \/>\n        }<br \/>\n        ret &#061; _ut.login(login_json);<br \/>\n        if (ret &#061;&#061; false)<br \/>\n        {<br \/>\n            DLOG(&#034;\u7528\u6237\u8f93\u5165\u9519\u8bef\u7528\u6237\u540d\/\u547d\u540d&#034;);<br \/>\n            return http_resp(false, websocketpp::http::status_code::bad_request, &#034;\u7528\u6237\u540d\/\u5bc6\u7801\u9519\u8bef&#xff01;&#034;, conn);<br \/>\n        }<br \/>\n        uint64_t uid &#061; login_json[&#034;id&#034;].asUInt64();<br \/>\n        session_ptr ssp &#061; _sm.create_session(uid, ONLOGIN);<br \/>\n        if (ssp.get() &#061;&#061; nullptr)<br \/>\n        {<br \/>\n            DLOG(&#034;\u521b\u5efa\u4f1a\u8bdd\u5931\u8d25&#034;);<br \/>\n            return http_resp(false, websocketpp::http::status_code::internal_server_error, &#034;\u521b\u5efa\u4f1a\u8bdd\u5931\u8d25&#xff01;&#034;, conn);<br \/>\n        }<br \/>\n        _sm.set_session_time(ssp-&gt;get_ssid(), SESSION_TIME);<br \/>\n        std::string cokie &#061; &#034;SSID&#061;&#034; &#043; std::to_string(ssp-&gt;get_ssid()) &#043; &#034;;Path&#061;\/&#034;;<br \/>\n        conn-&gt;append_header(&#034;Set-Cookie&#034;, cokie);<br \/>\n        return http_resp(true, websocketpp::http::status_code::ok, &#034;\u767b\u9646\u6210\u529f&#034;, conn);<br \/>\n    }<br \/>\n    void http_resp(bool ret, websocketpp::http::status_code::value code,<br \/>\n                   const std::string &amp;reason, websocket_server::connection_ptr &amp;conn)<br \/>\n    {<br \/>\n        Json::Value resp_json;<br \/>\n        resp_json[&#034;result&#034;] &#061; ret;<br \/>\n        resp_json[&#034;reason&#034;] &#061; reason;<br \/>\n        std::string resp_body;<br \/>\n        json_util::Serialization(resp_json, resp_body);<br \/>\n        conn-&gt;set_body(resp_body);<br \/>\n        conn-&gt;set_status(code);<br \/>\n        conn-&gt;append_header(&#034;Content-Type&#034;, &#034;application\/json;charset&#061;utf-8&#034;);<br \/>\n        return;<br \/>\n    }<br \/>\n    void reg(websocket_server::connection_ptr &amp;conn)<br \/>\n    {<br \/>\n        websocketpp::http::parser::request req &#061; conn-&gt;get_request();<br \/>\n        Json::Value login_json;<br \/>\n        \/\/ \u83b7\u53d6\u6b63\u6587<br \/>\n        std::string req_body &#061; conn-&gt;get_request_body();<br \/>\n        \/\/ \u53cd\u5e8f\u5217\u5316\u5f97\u5230\u7528\u6237\u540d\u548c\u5bc6\u7801<br \/>\n        bool ret &#061; json_util::Unserialization(req_body, login_json);<br \/>\n        if (ret &#061;&#061; false)<br \/>\n        {<br \/>\n            DLOG(&#034;\u53cd\u5e8f\u5217\u5316\u5931\u8d25&#034;);<br \/>\n            return http_resp(false, websocketpp::http::status_code::bad_request, &#034;\u8bf7\u6c42\u683c\u5f0f\u9519\u8bef&#xff01;&#034;, conn);<br \/>\n        }<br \/>\n        if (login_json[&#034;username&#034;].isNull() || login_json[&#034;password&#034;].isNull())<br \/>\n        {<br \/>\n            DLOG(&#034;\u7528\u6237\u63d0\u4ea4\u4fe1\u606f\u4e0d\u5b8c\u5168&#034;);<br \/>\n            return http_resp(false, websocketpp::http::status_code::bad_request, &#034;\u8bf7\u8f93\u5165\u7528\u6237\u540d\/\u5bc6\u7801&#xff01;&#034;, conn);<br \/>\n        }<br \/>\n        ret &#061; _ut.insert(login_json);<br \/>\n        if (ret &#061;&#061; false)<br \/>\n        {<br \/>\n            DLOG(&#034;\u63d2\u5165\u6570\u636e\u5e93\u5931\u8d25&#034;);<br \/>\n            return http_resp(false, websocketpp::http::status_code::bad_request, &#034;\u7528\u6237\u540d\u88ab\u5360\u7528&#xff01;&#034;, conn);<br \/>\n        }<br \/>\n        return http_resp(true, websocketpp::http::status_code::ok, &#034;\u6ce8\u518c\u6210\u529f&#xff01;&#034;, conn);<br \/>\n    }<br \/>\n    bool get_cookie_val(const std::string &amp;cookie, const std::string &amp;key, std::string &amp;val)<br \/>\n    {<br \/>\n        std::string tmp_cookie &#061; cookie;<br \/>\n        \/\/ \u628a\u6240\u6709&#034;;&#034;\u66ff\u6362\u6210&#034;; &#034;&#xff0c;\u89e3\u51b3\u5206\u53f7\u65e0\u7a7a\u683c\u5206\u5272\u5931\u8d25<br \/>\n        size_t pos &#061; 0;<br \/>\n        while ((pos &#061; tmp_cookie.find(&#039;;&#039;, pos)) !&#061; std::string::npos)<br \/>\n        {<br \/>\n            tmp_cookie.insert(pos &#043; 1, &#034; &#034;);<br \/>\n            pos &#043;&#061; 2;<br \/>\n        }<\/p>\n<p>        std::string sep &#061; &#034;; &#034;;<br \/>\n        std::vector&lt;std::string&gt; cookie_arr;<br \/>\n        string_util::split(tmp_cookie, sep, cookie_arr);<\/p>\n<p>        auto trim &#061; [](std::string &amp;s)<br \/>\n        {<br \/>\n            s.erase(0, s.find_first_not_of(&#034; \\\\t&#034;));<br \/>\n            s.erase(s.find_last_not_of(&#034; \\\\t&#034;) &#043; 1);<br \/>\n        };<\/p>\n<p>        for (auto &amp;m : cookie_arr)<br \/>\n        {<br \/>\n            std::vector&lt;std::string&gt; tem;<br \/>\n            string_util::split(m, &#034;&#061;&#034;, tem);<br \/>\n            if (tem.size() !&#061; 2)<br \/>\n                continue;<\/p>\n<p>            trim(tem[0]);<br \/>\n            trim(tem[1]);<\/p>\n<p>            if (tem[0] &#061;&#061; key)<br \/>\n            {<br \/>\n                val &#061; tem[1];<br \/>\n                return true;<br \/>\n            }<br \/>\n        }<br \/>\n        return false;<br \/>\n    }<\/p>\n<p>    void info(websocket_server::connection_ptr &amp;conn)<br \/>\n    {<br \/>\n        \/\/ \u83b7\u53d6cookie\u4fe1\u606f<br \/>\n        std::string cookie_str &#061; conn-&gt;get_request_header(&#034;Cookie&#034;);<br \/>\n        if (cookie_str.empty())<br \/>\n        {<br \/>\n            DLOG(&#034;\u627e\u4e0d\u5230cookie\u4fe1\u606f&#034;);<br \/>\n            return http_resp(false, websocketpp::http::status_code::bad_request, &#034;\u627e\u4e0d\u5230cookie\u4fe1\u606f&#xff0c;\u8bf7\u91cd\u65b0\u767b\u5f55&#xff01;&#034;, conn);<br \/>\n        }<br \/>\n        \/\/ \u83b7\u53d6ssid<br \/>\n        std::string ssid_str;<br \/>\n        bool ret &#061; get_cookie_val(cookie_str, &#034;SSID&#034;, ssid_str);<br \/>\n        if (ret &#061;&#061; false)<br \/>\n        {<br \/>\n            DLOG(&#034;\u627e\u4e0d\u5230ssid&#034;);<br \/>\n            return http_resp(false, websocketpp::http::status_code::bad_request, &#034;\u627e\u4e0d\u5230ssid\u4fe1\u606f&#xff0c;\u8bf7\u91cd\u65b0\u767b\u5f55&#xff01;&#034;, conn);<br \/>\n        }<br \/>\n        \/\/ \u67e5\u627esession<br \/>\n        session_ptr ssp &#061; _sm.get_session_by_ssid(std::stoll(ssid_str));<br \/>\n        if (ssp.get() &#061;&#061; nullptr)<br \/>\n        {<br \/>\n            DLOG(&#034;session\u8fc7\u671f&#034;);<br \/>\n            return http_resp(false, websocketpp::http::status_code::bad_request, &#034;\u767b\u5f55\u8fc7\u671f&#xff0c;\u8bf7\u91cd\u65b0\u767b\u5f55&#xff01;&#034;, conn);<br \/>\n        }<br \/>\n        \/\/ \u67e5\u8be2\u7528\u6237\u4fe1\u606f<br \/>\n        Json::Value root;<br \/>\n        uint64_t uid &#061; ssp-&gt;get_uid();<br \/>\n        ret &#061; _ut.selete_by_id(uid, root);<br \/>\n        if (ret &#061;&#061; false)<br \/>\n        {<br \/>\n            return http_resp(false, websocketpp::http::status_code::bad_request, &#034;\u627e\u4e0d\u5230\u7528\u6237\u4fe1\u606f&#xff0c;\u8bf7\u91cd\u65b0\u767b\u5f55&#xff01;&#034;, conn);<br \/>\n        }<br \/>\n        \/\/ \u8fd4\u56de\u7528\u6237\u4fe1\u606f<br \/>\n        std::string body;<br \/>\n        json_util::Serialization(root, body);<br \/>\n        conn-&gt;set_status(websocketpp::http::status_code::ok);<br \/>\n        conn-&gt;set_body(body);<br \/>\n        conn-&gt;append_header(&#034;Content-Type&#034;, &#034;application\/json;charset&#061;utf-8&#034;);<br \/>\n        \/\/ \u5237\u65b0\u8fc7\u671f\u65f6\u95f4<br \/>\n        _sm.set_session_time(ssp-&gt;get_ssid(), SESSION_TIME);<br \/>\n    }<br \/>\n    void http_callback(websocketpp::connection_hdl hdl)<br \/>\n    {<br \/>\n        websocket_server::connection_ptr conn &#061; _wssrv.get_con_from_hdl(hdl);<br \/>\n        websocketpp::http::parser::request req &#061; conn-&gt;get_request();<br \/>\n        std::string method &#061; req.get_method();<br \/>\n        std::string uri &#061; req.get_uri();<br \/>\n        if (method &#061;&#061; &#034;POST&#034; &amp;&amp; uri &#061;&#061; &#034;\/login&#034;)<br \/>\n        {<br \/>\n            return login(conn);<br \/>\n        }<br \/>\n        else if (method &#061;&#061; &#034;POST&#034; &amp;&amp; uri &#061;&#061; &#034;\/reg&#034;)<br \/>\n        {<br \/>\n            return reg(conn);<br \/>\n        }<br \/>\n        else if (method &#061;&#061; &#034;GET&#034; &amp;&amp; uri &#061;&#061; &#034;\/info&#034;)<br \/>\n        {<br \/>\n            return info(conn);<br \/>\n        }<br \/>\n        else<br \/>\n        {<br \/>\n            return file_handler(conn);<br \/>\n        }<br \/>\n    }<br \/>\n    void ws_resp(websocket_server::connection_ptr conn, Json::Value &amp;resp)<br \/>\n    {<br \/>\n        std::string body;<br \/>\n        json_util::Serialization(resp, body);<br \/>\n        conn-&gt;send(body);<br \/>\n    }<br \/>\n    session_ptr get_session_by_cookie(websocket_server::connection_ptr &amp;conn)<br \/>\n    {<br \/>\n        Json::Value err_resp;<br \/>\n        \/\/ \u83b7\u53d6cookie\u4fe1\u606f<br \/>\n        std::string cookie_str &#061; conn-&gt;get_request_header(&#034;Cookie&#034;);<br \/>\n        if (cookie_str.empty())<br \/>\n        {<br \/>\n            DLOG(&#034;\u627e\u4e0d\u5230cookie\u4fe1\u606f&#034;);<br \/>\n            err_resp[&#034;optype&#034;] &#061; &#034;hall_ready&#034;;<br \/>\n            err_resp[&#034;reason&#034;] &#061; &#034;\u627e\u4e0d\u5230cookie\u4fe1\u606f&#xff0c;\u8bf7\u91cd\u65b0\u767b\u5f55!&#034;;<br \/>\n            err_resp[&#034;result&#034;] &#061; false;<br \/>\n            ws_resp(conn, err_resp);<br \/>\n            return session_ptr();<br \/>\n        }<br \/>\n        \/\/ \u83b7\u53d6ssid<br \/>\n        std::string ssid_str;<br \/>\n        bool ret &#061; get_cookie_val(cookie_str, &#034;SSID&#034;, ssid_str);<br \/>\n        if (ret &#061;&#061; false)<br \/>\n        {<br \/>\n            DLOG(&#034;\u627e\u4e0d\u5230ssid&#034;);<br \/>\n            err_resp[&#034;optype&#034;] &#061; &#034;hall_ready&#034;;<br \/>\n            err_resp[&#034;reason&#034;] &#061; &#034;\u627e\u4e0d\u5230SSID\u4fe1\u606f&#xff0c;\u8bf7\u91cd\u65b0\u767b\u5f55!&#034;;<br \/>\n            err_resp[&#034;result&#034;] &#061; false;<br \/>\n            ws_resp(conn, err_resp);<br \/>\n            return session_ptr();<br \/>\n        }<br \/>\n        \/\/ \u67e5\u627esession<br \/>\n        session_ptr ssp &#061; _sm.get_session_by_ssid(std::stoll(ssid_str));<br \/>\n        if (ssp.get() &#061;&#061; nullptr)<br \/>\n        {<br \/>\n            DLOG(&#034;session\u8fc7\u671f&#034;);<br \/>\n            err_resp[&#034;optype&#034;] &#061; &#034;hall_ready&#034;;<br \/>\n            err_resp[&#034;reason&#034;] &#061; &#034;\u627e\u4e0d\u5230session\u4fe1\u606f&#xff0c;\u8bf7\u91cd\u65b0\u767b\u5f55!&#034;;<br \/>\n            err_resp[&#034;result&#034;] &#061; false;<br \/>\n            ws_resp(conn, err_resp);<br \/>\n            return session_ptr();<br \/>\n        }<br \/>\n        return ssp;<br \/>\n    }<br \/>\n    void wopen_hall(websocket_server::connection_ptr conn)<br \/>\n    {<br \/>\n        Json::Value err_resp;<br \/>\n        session_ptr ssp &#061; get_session_by_cookie(conn);<br \/>\n        if (ssp.get() &#061;&#061; nullptr)<br \/>\n        {<br \/>\n            return;<br \/>\n        }<br \/>\n        \/\/ \u662f\u5426\u91cd\u590d\u767b\u5f55<br \/>\n        if (_om.is_in_game_hall(ssp-&gt;get_uid()) || _om.is_in_game_room(ssp-&gt;get_uid()))<br \/>\n        {<br \/>\n            err_resp[&#034;optype&#034;] &#061; &#034;hall_ready&#034;;<br \/>\n            err_resp[&#034;reason&#034;] &#061; &#034;\u73a9\u5bb6\u91cd\u590d\u767b\u5f55!&#034;;<br \/>\n            err_resp[&#034;result&#034;] &#061; false;<br \/>\n            return ws_resp(conn, err_resp);<br \/>\n        }<br \/>\n        \/\/ \u5c06\u5ba2\u6237\u7aef\u53ca\u5176\u94fe\u63a5\u6dfb\u52a0\u5230\u6e38\u620f\u5927\u5385<br \/>\n        _om.enter_game_hall(ssp-&gt;get_uid(), conn);<br \/>\n        Json::Value resp_json;<br \/>\n        resp_json[&#034;optype&#034;] &#061; &#034;hall_ready&#034;;<br \/>\n        resp_json[&#034;result&#034;] &#061; true;<br \/>\n        ws_resp(conn, resp_json);<br \/>\n        \/\/ \u5c31\u4ee5\u540esession\u8bbe\u7f6e\u4e3a\u6c38\u4e45\u5b58\u5728<br \/>\n        _sm.set_session_time(ssp-&gt;get_ssid(), SESSION_PERMANENT);<br \/>\n    }<br \/>\n    void wopen_room(websocket_server::connection_ptr conn)<br \/>\n    {<br \/>\n        \/\/ \u83b7\u53d6\u7528\u6237session<br \/>\n        Json::Value resp_json;<br \/>\n        session_ptr ssp &#061; get_session_by_cookie(conn);<br \/>\n        if (ssp.get() &#061;&#061; nullptr)<br \/>\n        {<br \/>\n            return;<br \/>\n        }<br \/>\n        \/\/ \u662f\u5426\u91cd\u590d\u767b\u5f55<br \/>\n        if (_om.is_in_game_hall(ssp-&gt;get_uid()) || _om.is_in_game_room(ssp-&gt;get_uid()))<br \/>\n        {<br \/>\n            DLOG(&#034;\u73a9\u5bb6\u91cd\u590d\u767b\u5f55!&#034;);<br \/>\n            resp_json[&#034;optype&#034;] &#061; &#034;room_ready&#034;;<br \/>\n            resp_json[&#034;reason&#034;] &#061; &#034;\u73a9\u5bb6\u91cd\u590d\u767b\u5f55!&#034;;<br \/>\n            resp_json[&#034;result&#034;] &#061; false;<br \/>\n            return ws_resp(conn, resp_json);<br \/>\n        }<br \/>\n        \/\/ \u662f\u5426\u5df2\u7ecf\u6709\u623f\u95f4<br \/>\n        room_ptr rm &#061; _rm.get_room_by_uid(ssp-&gt;get_uid());<br \/>\n        if (rm.get() &#061;&#061; nullptr)<br \/>\n        {<br \/>\n            DLOG(&#034;\u627e\u4e0d\u5230\u73a9\u5bb6\u623f\u95f4\u4fe1\u606f!&#034;);<br \/>\n            resp_json[&#034;optype&#034;] &#061; &#034;room_ready&#034;;<br \/>\n            resp_json[&#034;reason&#034;] &#061; &#034;\u627e\u4e0d\u5230\u73a9\u5bb6\u623f\u95f4\u4fe1\u606f!&#034;;<br \/>\n            resp_json[&#034;result&#034;] &#061; false;<br \/>\n            return ws_resp(conn, resp_json);<br \/>\n        }<br \/>\n        \/\/ \u6dfb\u52a0\u5230\u5728\u7ebf\u7528\u6237\u623f\u95f4\u4e2d<br \/>\n        _om.enter_game_room(ssp-&gt;get_uid(), conn);<br \/>\n        \/\/ \u8bbe\u7f6esession\u6c38\u4e45\u5b58\u5728<br \/>\n        _sm.set_session_time(ssp-&gt;get_ssid(), SESSION_PERMANENT);<br \/>\n        resp_json[&#034;optype&#034;] &#061; &#034;room_ready&#034;;<br \/>\n        resp_json[&#034;result&#034;] &#061; true;<br \/>\n        resp_json[&#034;room_id&#034;] &#061; (Json::UInt64)rm-&gt;get_room_id();<br \/>\n        resp_json[&#034;uid&#034;] &#061; (Json::UInt64)ssp-&gt;get_uid();<br \/>\n        resp_json[&#034;white_id&#034;] &#061; (Json::UInt64)rm-&gt;get_white_id();<\/p>\n<p>        return ws_resp(conn, resp_json);<br \/>\n    }<br \/>\n    void wopen_callback(websocketpp::connection_hdl hdl)<br \/>\n    {<br \/>\n        websocket_server::connection_ptr conn &#061; _wssrv.get_con_from_hdl(hdl);<br \/>\n        websocketpp::http::parser::request req &#061; conn-&gt;get_request();<br \/>\n        std::string uri &#061; req.get_uri();<br \/>\n        if (uri &#061;&#061; &#034;\/hall&#034;)<br \/>\n        {<br \/>\n            \/\/ \u5efa\u7acb\u6e38\u620f\u5927\u5385\u957f\u8fde\u63a5<br \/>\n            return wopen_hall(conn);<br \/>\n        }<br \/>\n        else if (uri &#061;&#061; &#034;\/room&#034;)<br \/>\n        {<br \/>\n            \/\/ \u5efa\u7acb\u6e38\u620f\u623f\u95f4\u957f\u8fde\u63a5<br \/>\n            return wopen_room(conn);<br \/>\n        }<br \/>\n    }<br \/>\n    void wclose_game_hall(websocket_server::connection_ptr conn)<br \/>\n    {<br \/>\n        session_ptr ssp &#061; get_session_by_cookie(conn);<br \/>\n        if (ssp.get() &#061;&#061; nullptr)<br \/>\n        {<br \/>\n            return;<br \/>\n        }<br \/>\n        \/\/ \u5c06\u73a9\u5bb6\u4ece\u6e38\u620f\u5927\u5385\u4e2d\u79fb\u9664<br \/>\n        _om.exit_game_hall(ssp-&gt;get_uid());<br \/>\n        \/\/ \u8bbe\u7f6esession\u8fc7\u671f\u65f6\u95f4<br \/>\n        _sm.set_session_time(ssp-&gt;get_ssid(), SESSION_TIME);<br \/>\n    }<br \/>\n    void wclose_game_room(websocket_server::connection_ptr conn)<br \/>\n    {<br \/>\n        session_ptr ssp &#061; get_session_by_cookie(conn);<br \/>\n        if (ssp.get() &#061;&#061; nullptr)<br \/>\n        {<br \/>\n            return;<br \/>\n        }<br \/>\n        \/\/ \u5c06\u73a9\u5bb6\u4ece\u6e38\u620f\u623f\u95f4\u5728\u7ebf\u7528\u6237\u5217\u8868\u4e2d\u79fb\u9664<br \/>\n        _om.exit_game_room(ssp-&gt;get_uid());<br \/>\n        \/\/ \u8bbe\u7f6esession\u6c38\u4e0d\u8fc7\u671f<br \/>\n        _sm.set_session_time(ssp-&gt;get_ssid(), SESSION_TIME);<br \/>\n        \/\/ \u51cf\u5c11\u623f\u95f4\u4eba\u6570<br \/>\n        _rm.remove_room_user(ssp-&gt;get_uid());<br \/>\n    }<br \/>\n    void wclose_callback(websocketpp::connection_hdl hdl)<br \/>\n    {<br \/>\n        websocket_server::connection_ptr conn &#061; _wssrv.get_con_from_hdl(hdl);<br \/>\n        websocketpp::http::parser::request req &#061; conn-&gt;get_request();<br \/>\n        std::string uri &#061; req.get_uri();<br \/>\n        if (uri &#061;&#061; &#034;\/hall&#034;)<br \/>\n        {<br \/>\n            \/\/ \u65ad\u5f00\u6e38\u620f\u5927\u5385\u957f\u8fde\u63a5<br \/>\n            return wclose_game_hall(conn);<br \/>\n        }<br \/>\n        else if (uri &#061;&#061; &#034;\/room&#034;)<br \/>\n        {<br \/>\n            \/\/ \u65ad\u5f00\u6e38\u620f\u623f\u95f4\u957f\u8fde\u63a5<br \/>\n            return wclose_game_room(conn);<br \/>\n        }<br \/>\n    }<br \/>\n    void wmessage_game_hall(websocket_server::connection_ptr conn, websocket_server::message_ptr msg)<br \/>\n    {<br \/>\n        \/\/ \u9a8c\u8bc1\u8eab\u4efd<br \/>\n        session_ptr ssp &#061; get_session_by_cookie(conn);<br \/>\n        if (ssp.get() &#061;&#061; nullptr)<br \/>\n        {<br \/>\n            return;<br \/>\n        }<br \/>\n        \/\/ \u83b7\u53d6\u8bf7\u6c42\u4fe1\u606f<br \/>\n        std::string resp_str &#061; msg-&gt;get_payload();<br \/>\n        Json::Value resp_json;<br \/>\n        bool ret &#061; json_util::Unserialization(resp_str, resp_json);<br \/>\n        if (ret &#061;&#061; false)<br \/>\n        {<br \/>\n            resp_json[&#034;reasont&#034;] &#061; &#034;\u8bf7\u6c42\u89e3\u6790\u5931\u8d25&#034;;<br \/>\n            resp_json[&#034;result&#034;] &#061; false;<br \/>\n            return ws_resp(conn, resp_json);<br \/>\n        }<br \/>\n        if (!resp_json[&#034;optype&#034;].isNull() &amp;&amp; resp_json[&#034;optype&#034;].asString() &#061;&#061; &#034;match_start&#034;)<br \/>\n        {<br \/>\n            \/\/ \u5c06\u73a9\u5bb6\u52a0\u5165\u5339\u914d\u961f\u5217<br \/>\n            DLOG(&#034;\u5904\u7406\u4e86\u5339\u914d\u6d88\u606f&#034;);<br \/>\n            _mm.add(ssp-&gt;get_uid());<br \/>\n            resp_json[&#034;optype&#034;] &#061; &#034;match_start&#034;;<br \/>\n            resp_json[&#034;result&#034;] &#061; true;<br \/>\n            return ws_resp(conn, resp_json);<br \/>\n        }<br \/>\n        else if (!resp_json[&#034;optype&#034;].isNull() &amp;&amp; resp_json[&#034;optype&#034;].asString() &#061;&#061; &#034;match_stop&#034;)<br \/>\n        {<br \/>\n            \/\/ \u73a9\u5bb6\u4ece\u5339\u914d\u961f\u5217\u4e2d\u79fb\u9664<br \/>\n            DLOG(&#034;\u5904\u7406\u4e86\u53d6\u6d88\u5339\u914d\u6d88\u606f&#034;);<br \/>\n            _mm.del(ssp-&gt;get_uid());<br \/>\n            resp_json[&#034;optype&#034;] &#061; &#034;match_stop&#034;;<br \/>\n            resp_json[&#034;result&#034;] &#061; true;<br \/>\n            return ws_resp(conn, resp_json);<br \/>\n        }<br \/>\n        resp_json[&#034;optype&#034;] &#061; &#034;unknown&#034;;<br \/>\n        resp_json[&#034;result&#034;] &#061; false;<br \/>\n        return ws_resp(conn, resp_json);<br \/>\n    }<br \/>\n    void wmessage_game_room(websocket_server::connection_ptr conn, websocket_server::message_ptr msg)<br \/>\n    {<br \/>\n        DLOG(&#034;wmessage_game_room \u5f00\u59cb\u5904\u7406&#034;);<br \/>\n        Json::Value resp_json;<br \/>\n        \/\/ \u83b7\u53d6session\u4fe1\u606f<br \/>\n        session_ptr ssp &#061; get_session_by_cookie(conn);<br \/>\n        if (ssp.get() &#061;&#061; nullptr)<br \/>\n        {<br \/>\n            return;<br \/>\n        }<br \/>\n        DLOG(&#034;wmessage_game_room: uid&#061;%lu&#034;, ssp-&gt;get_uid());<br \/>\n        \/\/\u83b7\u53d6\u623f\u95f4\u4fe1\u606f<br \/>\n        room_ptr rm &#061; _rm.get_room_by_uid(ssp-&gt;get_uid());<br \/>\n        if (rm.get() &#061;&#061; nullptr)<br \/>\n        {<br \/>\n            DLOG(&#034;\u627e\u4e0d\u5230\u73a9\u5bb6\u623f\u95f4\u4fe1\u606f!&#034;);<br \/>\n            resp_json[&#034;optype&#034;] &#061; &#034;unknown&#034;;<br \/>\n            resp_json[&#034;reason&#034;] &#061; &#034;\u627e\u4e0d\u5230\u73a9\u5bb6\u623f\u95f4\u4fe1\u606f!&#034;;<br \/>\n            resp_json[&#034;result&#034;] &#061; false;<br \/>\n            return ws_resp(conn, resp_json);<br \/>\n        }<br \/>\n        DLOG(&#034;\u627e\u5230\u623f\u95f4: room_id&#061;%lu&#034;, rm-&gt;get_room_id());<br \/>\n        \/\/ \u83b7\u53d6\u8bf7\u6c42\u4fe1\u606f<br \/>\n        std::string resp_str &#061; msg-&gt;get_payload();<br \/>\n        DLOG(&#034;\u6536\u5230\u623f\u95f4\u6d88\u606f: %s&#034;, resp_str.c_str());<br \/>\n        bool ret &#061; json_util::Unserialization(resp_str, resp_json);<br \/>\n        if(ret &#061;&#061; false)<br \/>\n        {<br \/>\n            DLOG(&#034;\u8bf7\u6c42\u89e3\u6790\u5931\u8d25!&#034;);<br \/>\n            resp_json[&#034;optype&#034;] &#061; &#034;unknown&#034;;<br \/>\n            resp_json[&#034;reason&#034;] &#061; &#034;\u8bf7\u6c42\u89e3\u6790\u5931\u8d25&#034;;<br \/>\n            resp_json[&#034;result&#034;] &#061; false;<br \/>\n            return ws_resp(conn, resp_json);<br \/>\n        }<br \/>\n        DLOG(&#034;\u8c03\u7528 handle_request, optype&#061;%s&#034;, resp_json[&#034;optype&#034;].asString().c_str());<br \/>\n        return rm-&gt;handle_request(resp_json);<br \/>\n    }<br \/>\n    void wmessage_callback(websocketpp::connection_hdl hdl, websocket_server::message_ptr msg)<br \/>\n    {<br \/>\n        websocket_server::connection_ptr conn &#061; _wssrv.get_con_from_hdl(hdl);<br \/>\n        websocketpp::http::parser::request req &#061; conn-&gt;get_request();<br \/>\n        std::string uri &#061; req.get_uri();<br \/>\n        if (uri &#061;&#061; &#034;\/hall&#034;)<br \/>\n        {<br \/>\n            \/\/ \u6536\u5230\u6e38\u620f\u5927\u5385\u6d88\u606f<br \/>\n            DLOG(&#034;\u6536\u5230\u6e38\u620f\u5927\u5385\u6d88\u606f&#034;);<br \/>\n            return wmessage_game_hall(conn, msg);<br \/>\n        }<br \/>\n        else if (uri &#061;&#061; &#034;\/room&#034;)<br \/>\n        {<br \/>\n            \/\/ \u6536\u5230\u6e38\u620f\u623f\u95f4\u6d88\u606f<br \/>\n            DLOG(&#034;\u6536\u5230\u6e38\u620f\u623f\u95f4\u6d88\u606f&#034;);<br \/>\n            return wmessage_game_room(conn,msg);<br \/>\n        }<br \/>\n    }<\/p>\n<p>public:<br \/>\n    gobang_server(const std::string &amp;host,<br \/>\n                  const std::string &amp;user,<br \/>\n                  const std::string &amp;password,<br \/>\n                  const std::string &amp;db, unsigned int port &#061; 3306,<br \/>\n                  const std::string &amp;wwwroot &#061; WWWROOT)<br \/>\n        : _web_root(wwwroot), _ut(host, user, password, db, port), _sm(&amp;_wssrv), _rm(&amp;_ut, &amp;_om), _mm(&amp;_ut, &amp;_om, &amp;_rm)<br \/>\n    {<br \/>\n        _wssrv.set_access_channels(websocketpp::log::alevel::none);<br \/>\n        _wssrv.init_asio();<br \/>\n        _wssrv.set_reuse_addr(true);<br \/>\n        _wssrv.set_open_handler(std::bind(&amp;gobang_server::wopen_callback, this, std::placeholders::_1));<br \/>\n        _wssrv.set_close_handler(std::bind(&amp;gobang_server::wclose_callback, this, std::placeholders::_1));<br \/>\n        _wssrv.set_message_handler(std::bind(&amp;gobang_server::wmessage_callback, this, std::placeholders::_1, std::placeholders::_2));<br \/>\n        _wssrv.set_http_handler(std::bind(&amp;gobang_server::http_callback, this, std::placeholders::_1));<br \/>\n    }<br \/>\n    void start(int port)<br \/>\n    {<br \/>\n        _wssrv.listen(port);<br \/>\n        _wssrv.start_accept();<br \/>\n        _wssrv.run();<br \/>\n    }<br \/>\n};<\/p>\n<p>#endif <\/p>\n<h2>\u00a0 \u00a0 \u00a0 \u00a0 3.\u5ba2\u6237\u7aef<\/h2>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u7528\u6237\u8ba4\u8bc1\u6a21\u5757\u652f\u6301\u767b\u5f55\u548c\u6ce8\u518c\u529f\u80fd&#xff0c;\u5305\u542b\u8868\u5355\u975e\u7a7a\u6821\u9a8c&#xff0c;\u767b\u5f55\u4e0e\u6ce8\u518c\u8868\u5355\u652f\u6301Tab\u5207\u6362&#xff0c;\u767b\u5f55\u6210\u529f\u540e\u8df3\u8f6c\u6e38\u620f\u5927\u5385&#xff0c;\u6ce8\u518c\u6210\u529f\u540e\u63d0\u793a\u8fd4\u56de\u767b\u5f55\u3002<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u6e38\u620f\u5927\u5385\u6a21\u5757\u5c55\u793a\u7528\u6237\u4fe1\u606f&#xff0c;\u5305\u62ec\u7528\u6237\u540d\u3001\u79ef\u5206\u3001\u603b\u573a\u6b21\u548c\u80dc\u573a\u6570&#xff0c;\u652f\u6301\u5f00\u59cb\u5339\u914d\u548c\u53d6\u6d88\u5339\u914d&#xff0c;WebSocket\u8fde\u63a5\u5177\u5907\u81ea\u52a8\u91cd\u8fde\u673a\u5236&#xff0c;\u5339\u914d\u6210\u529f\u540e\u81ea\u52a8\u8fdb\u5165\u6e38\u620f\u623f\u95f4\u3002<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u6e38\u620f\u623f\u95f4\u6a21\u5757\u63d0\u4f9b15\u00d715\u6807\u51c6\u4e94\u5b50\u68cb\u68cb\u76d8&#xff0c;\u4f7f\u7528Canvas\u6e32\u67d3&#xff0c;\u652f\u6301\u9ed1\u767d\u68cb\u5b50\u4ea4\u66ff\u843d\u5b50&#xff0c;\u56de\u5408\u5236\u5bf9\u6218\u660e\u786e\u63d0\u793a\u5f53\u524d\u8f6e\u5230\u8c01\u843d\u5b50&#xff0c;\u5177\u5907\u80dc\u8d1f\u5224\u5b9a\u529f\u80fd\u3002\u623f\u95f4\u5185\u8fd8\u5305\u542b\u5b9e\u65f6\u804a\u5929\u529f\u80fd&#xff0c;\u6d88\u606f\u533a\u5206\u5df1\u65b9\u548c\u5bf9\u65b9&#xff0c;\u5bf9\u624b\u6389\u7ebf\u65f6\u81ea\u52a8\u5224\u80dc&#xff0c;\u8fde\u63a5\u65ad\u5f00\u65f6\u63d0\u4f9b\u8fd4\u56de\u5927\u5385\u5165\u53e3\u3002<\/p>\n<h3>\u00a0 \u00a0 \u00a0 \u00a0 3.1\u5177\u4f53\u5b9e\u73b0<\/h3>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u56e0\u4e3a\u524d\u7aef\u90fd\u662f\u5b9e\u73b0\u4e00\u4e9b\u7b80\u5355\u7684\u529f\u80fd\u52a0\u4e0a\u5b57\u6570\u8fc7\u591a\u7684\u7f18\u6545\u5c31\u4e0d\u76f4\u63a5\u53d1\u51fa\u6765\u4e86&#xff0c;\u53ef\u4ee5\u53bb\u6587\u6863git\u91cc\u67e5\u770b\u30025\u6708\/26\/SourceCode\/server.hpp \u00b7 \u6d6a\u5ba2\u707f\u5fc3\/\u963f\u707f &#8211; \u7801\u4e91 &#8211; \u5f00\u6e90\u4e2d\u56fd\u3002<\/p>\n<\/p>\n<\/p>\n<\/p>\n<\/p>\n<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1.\u901a\u4fe1\u63a5\u53e3\u8bbe\u8ba1 \u670d\u52a1\u5668\u6a21\u5757\u662f\u5bf9\u5f53\u524d\u6240\u6709\u5df2\u7ecf\u5b9e\u73b0\u7684\u6a21\u5757\u7684\u4e00\u4e2a\u6574\u5408&#xff0c;\u5e76\u8fdb\u884c\u670d\u52a1\u7684\u6a21\u5757\u3002\u4f7f\u7528websocket\u5e93\u7684\u63a5\u53e3\u6765\u642d\u5efa\u670d\u52a1\u5668\u7684\u57fa\u672c\u67b6\u6784&#xff0c;\u518d\u5b9e\u73b0\u56db\u4e2a\u4e3b\u8981\u7684\u63a5\u53e3&#xff1a;http\u8bf7\u6c42\u7684\u63a5\u53e3&#xff0c;\u5efa\u7acbwebsocket\u94fe\u63a5\u8bf7\u6c42&#xff0c;\u65ad\u5f00websocket\u94fe\u63a5\u8bf7\u6c42&#xff0c;websocket\u901a\u4fe1\u8bf7\u6c42\u3002 1.1http\u8bf7\u6c42\u63a5\u53e3 \u7528\u6237\u5728\u672a\u5efa\u7acbwebsocket\u957f\u8fde\u63a5\u5728\u524d\u9700\u8981\u901a\u8fc7http\u8fdb\u884c\u901a\u4fe1&#xff0c;\u7528\u6237\u7684\u8bf7\u6c42\u4e00\u5171\u5206\u4e3a<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[55,114],"topic":[],"class_list":["post-81165","post","type-post","status-publish","format-standard","hentry","category-server","tag-c","tag-mysql"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u9879\u76ee\u7bc7\uff1a\u670d\u52a1\u5668\u6a21\u5757\u53ca\u5ba2\u6237\u7aef\u7684\u8bbe\u8ba1\u4e0e\u5b9e\u73b0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/81165.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u9879\u76ee\u7bc7\uff1a\u670d\u52a1\u5668\u6a21\u5757\u53ca\u5ba2\u6237\u7aef\u7684\u8bbe\u8ba1\u4e0e\u5b9e\u73b0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"1.\u901a\u4fe1\u63a5\u53e3\u8bbe\u8ba1 \u670d\u52a1\u5668\u6a21\u5757\u662f\u5bf9\u5f53\u524d\u6240\u6709\u5df2\u7ecf\u5b9e\u73b0\u7684\u6a21\u5757\u7684\u4e00\u4e2a\u6574\u5408&#xff0c;\u5e76\u8fdb\u884c\u670d\u52a1\u7684\u6a21\u5757\u3002\u4f7f\u7528websocket\u5e93\u7684\u63a5\u53e3\u6765\u642d\u5efa\u670d\u52a1\u5668\u7684\u57fa\u672c\u67b6\u6784&#xff0c;\u518d\u5b9e\u73b0\u56db\u4e2a\u4e3b\u8981\u7684\u63a5\u53e3&#xff1a;http\u8bf7\u6c42\u7684\u63a5\u53e3&#xff0c;\u5efa\u7acbwebsocket\u94fe\u63a5\u8bf7\u6c42&#xff0c;\u65ad\u5f00websocket\u94fe\u63a5\u8bf7\u6c42&#xff0c;websocket\u901a\u4fe1\u8bf7\u6c42\u3002 1.1http\u8bf7\u6c42\u63a5\u53e3 \u7528\u6237\u5728\u672a\u5efa\u7acbwebsocket\u957f\u8fde\u63a5\u5728\u524d\u9700\u8981\u901a\u8fc7http\u8fdb\u884c\u901a\u4fe1&#xff0c;\u7528\u6237\u7684\u8bf7\u6c42\u4e00\u5171\u5206\u4e3a\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/81165.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-07-24T16:12:17+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"12 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/81165.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/81165.html\",\"name\":\"\u9879\u76ee\u7bc7\uff1a\u670d\u52a1\u5668\u6a21\u5757\u53ca\u5ba2\u6237\u7aef\u7684\u8bbe\u8ba1\u4e0e\u5b9e\u73b0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-07-24T16:12:17+00:00\",\"dateModified\":\"2026-07-24T16:12:17+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/81165.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/81165.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/81165.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u9879\u76ee\u7bc7\uff1a\u670d\u52a1\u5668\u6a21\u5757\u53ca\u5ba2\u6237\u7aef\u7684\u8bbe\u8ba1\u4e0e\u5b9e\u73b0\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u9879\u76ee\u7bc7\uff1a\u670d\u52a1\u5668\u6a21\u5757\u53ca\u5ba2\u6237\u7aef\u7684\u8bbe\u8ba1\u4e0e\u5b9e\u73b0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/81165.html","og_locale":"zh_CN","og_type":"article","og_title":"\u9879\u76ee\u7bc7\uff1a\u670d\u52a1\u5668\u6a21\u5757\u53ca\u5ba2\u6237\u7aef\u7684\u8bbe\u8ba1\u4e0e\u5b9e\u73b0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"1.\u901a\u4fe1\u63a5\u53e3\u8bbe\u8ba1 \u670d\u52a1\u5668\u6a21\u5757\u662f\u5bf9\u5f53\u524d\u6240\u6709\u5df2\u7ecf\u5b9e\u73b0\u7684\u6a21\u5757\u7684\u4e00\u4e2a\u6574\u5408&#xff0c;\u5e76\u8fdb\u884c\u670d\u52a1\u7684\u6a21\u5757\u3002\u4f7f\u7528websocket\u5e93\u7684\u63a5\u53e3\u6765\u642d\u5efa\u670d\u52a1\u5668\u7684\u57fa\u672c\u67b6\u6784&#xff0c;\u518d\u5b9e\u73b0\u56db\u4e2a\u4e3b\u8981\u7684\u63a5\u53e3&#xff1a;http\u8bf7\u6c42\u7684\u63a5\u53e3&#xff0c;\u5efa\u7acbwebsocket\u94fe\u63a5\u8bf7\u6c42&#xff0c;\u65ad\u5f00websocket\u94fe\u63a5\u8bf7\u6c42&#xff0c;websocket\u901a\u4fe1\u8bf7\u6c42\u3002 1.1http\u8bf7\u6c42\u63a5\u53e3 \u7528\u6237\u5728\u672a\u5efa\u7acbwebsocket\u957f\u8fde\u63a5\u5728\u524d\u9700\u8981\u901a\u8fc7http\u8fdb\u884c\u901a\u4fe1&#xff0c;\u7528\u6237\u7684\u8bf7\u6c42\u4e00\u5171\u5206\u4e3a","og_url":"https:\/\/www.wsisp.com\/helps\/81165.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-07-24T16:12:17+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"12 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/81165.html","url":"https:\/\/www.wsisp.com\/helps\/81165.html","name":"\u9879\u76ee\u7bc7\uff1a\u670d\u52a1\u5668\u6a21\u5757\u53ca\u5ba2\u6237\u7aef\u7684\u8bbe\u8ba1\u4e0e\u5b9e\u73b0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-07-24T16:12:17+00:00","dateModified":"2026-07-24T16:12:17+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/81165.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/81165.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/81165.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u9879\u76ee\u7bc7\uff1a\u670d\u52a1\u5668\u6a21\u5757\u53ca\u5ba2\u6237\u7aef\u7684\u8bbe\u8ba1\u4e0e\u5b9e\u73b0"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/81165","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=81165"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/81165\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=81165"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=81165"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=81165"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=81165"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}