{"id":2851,"date":"2025-03-16T12:29:14","date_gmt":"2025-03-16T04:29:14","guid":{"rendered":"https:\/\/www.laixuexila.com\/?p=2851"},"modified":"2025-03-16T12:29:14","modified_gmt":"2025-03-16T04:29:14","slug":"python3-%e7%bd%91%e7%bb%9c%e7%bc%96%e7%a8%8b14%ef%bc%9a%e4%bd%bf%e7%94%a8-websocket-%e5%ae%9e%e7%8e%b0%e5%ae%9e%e6%97%b6%e5%ba%94%e7%94%a8","status":"publish","type":"post","link":"https:\/\/www.laixuexila.com\/index.php\/2025\/03\/16\/python3-%e7%bd%91%e7%bb%9c%e7%bc%96%e7%a8%8b14%ef%bc%9a%e4%bd%bf%e7%94%a8-websocket-%e5%ae%9e%e7%8e%b0%e5%ae%9e%e6%97%b6%e5%ba%94%e7%94%a8\/","title":{"rendered":"Python3 \u7f51\u7edc\u7f16\u7a0b14\uff1a\u4f7f\u7528 WebSocket \u5b9e\u73b0\u5b9e\u65f6\u5e94\u7528"},"content":{"rendered":"\n<p>WebSocket \u662f\u4e00\u79cd\u5168\u53cc\u5de5\u901a\u4fe1\u534f\u8bae\uff0c\u5141\u8bb8\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\u4e4b\u95f4\u5b9e\u65f6\u5730\u8fdb\u884c\u6570\u636e\u4ea4\u6362\u3002\u4e0e HTTP \u534f\u8bae\u4e0d\u540c\uff0cWebSocket \u5efa\u7acb\u4e86\u4e00\u4e2a\u6301\u4e45\u7684\u8fde\u63a5\uff0c\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\u53ef\u4ee5\u968f\u65f6\u5411\u5bf9\u65b9\u53d1\u9001\u6d88\u606f\uff0c\u56e0\u6b64\u975e\u5e38\u9002\u7528\u4e8e\u5b9e\u65f6\u5e94\u7528\uff0c\u5982\u5728\u7ebf\u804a\u5929\u3001\u901a\u77e5\u63a8\u9001\u3001\u6e38\u620f\u5e94\u7528\u7b49\u3002<\/p>\n\n\n\n<p>Python \u4e2d\u7684 <code>FastAPI<\/code> \u548c <code>WebSockets<\/code> \u5e93\u53ef\u4ee5\u8f7b\u677e\u5b9e\u73b0 WebSocket \u670d\u52a1\u3002\u4e0b\u9762\u6211\u4eec\u5c06\u6df1\u5165\u63a2\u8ba8\u5982\u4f55\u4f7f\u7528 WebSocket \u6784\u5efa\u5b9e\u65f6\u5e94\u7528\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>14.1 \u5b89\u88c5 WebSocket \u5e93<\/strong><\/h2>\n\n\n\n<p>FastAPI \u81ea\u5e26\u4e86\u5bf9 WebSocket \u7684\u652f\u6301\uff0c\u4f46\u4e3a\u4e86\u4fbf\u4e8e\u64cd\u4f5c\uff0c\u6211\u4eec\u53ef\u4ee5\u5355\u72ec\u5b89\u88c5 WebSocket \u76f8\u5173\u7684\u5e93\u3002\u5b89\u88c5 <code>websockets<\/code> \u5e93\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip install websockets<\/code><\/pre>\n\n\n\n<p>FastAPI \u5df2\u7ecf\u5185\u5efa\u4e86 WebSocket \u7684\u652f\u6301\uff0c\u6240\u4ee5\u76f4\u63a5\u4f7f\u7528 FastAPI \u5c31\u53ef\u4ee5\u5b9e\u73b0 WebSocket \u670d\u52a1\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>14.2 \u4f7f\u7528 FastAPI \u548c WebSocket \u521b\u5efa\u5b9e\u65f6\u804a\u5929\u5e94\u7528<\/strong><\/h2>\n\n\n\n<p>\u4e0b\u9762\u662f\u4f7f\u7528 FastAPI \u548c WebSocket \u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684\u5b9e\u65f6\u804a\u5929\u5e94\u7528\u7684\u793a\u4f8b\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>14.2.1 \u521b\u5efa WebSocket \u670d\u52a1<\/strong><\/h3>\n\n\n\n<p>\u5728 FastAPI \u4e2d\uff0cWebSocket \u88ab\u5f53\u4f5c\u5f02\u6b65\u8def\u7531\u5904\u7406\u3002\u4e0b\u9762\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u804a\u5929\u670d\u52a1\uff0c\u5ba2\u6237\u7aef\u53ef\u4ee5\u8fde\u63a5\u5230\u670d\u52a1\u5668\uff0c\u5e76\u4e0e\u5176\u4ed6\u5ba2\u6237\u7aef\u5b9e\u65f6\u901a\u4fe1\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from fastapi import FastAPI, WebSocket, WebSocketDisconnect\nfrom typing import List\n\napp = FastAPI()\n\n# \u7528\u4e8e\u4fdd\u5b58\u5f53\u524d\u8fde\u63a5\u7684 WebSocket \u5ba2\u6237\u7aef\nclients: List&#91;WebSocket] = &#91;]\n\n@app.websocket(\"\/ws\/chat\")\nasync def chat_websocket(websocket: WebSocket):\n    # \u5efa\u7acb\u8fde\u63a5\u65f6\uff0c\u6dfb\u52a0\u5ba2\u6237\u7aef\u5230\u5217\u8868\n    await websocket.accept()\n    clients.append(websocket)\n    try:\n        while True:\n            # \u63a5\u6536\u5ba2\u6237\u7aef\u53d1\u9001\u7684\u6d88\u606f\n            message = await websocket.receive_text()\n            # \u5e7f\u64ad\u6d88\u606f\u7ed9\u6240\u6709\u8fde\u63a5\u7684\u5ba2\u6237\u7aef\n            for client in clients:\n                if client != websocket:\n                    await client.send_text(message)\n    except WebSocketDisconnect:\n        # \u5ba2\u6237\u7aef\u65ad\u5f00\u65f6\uff0c\u79fb\u9664\u8be5\u5ba2\u6237\u7aef\n        clients.remove(websocket)<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>14.2.2 \u542f\u52a8 WebSocket \u670d\u52a1<\/strong><\/h3>\n\n\n\n<p>\u542f\u52a8 FastAPI \u670d\u52a1\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>uvicorn main:app --reload<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>14.2.3 \u5ba2\u6237\u7aef\u8fde\u63a5<\/strong><\/h3>\n\n\n\n<p>\u8981\u6d4b\u8bd5\u8fd9\u4e2a\u804a\u5929\u5e94\u7528\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528 JavaScript \u4e2d\u7684 WebSocket API \u6765\u8fde\u63a5\u5230 WebSocket \u670d\u52a1\u3002\u4f8b\u5982\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>let socket = new WebSocket(\"ws:\/\/127.0.0.1:8000\/ws\/chat\");\n\nsocket.onopen = () =&gt; {\n  console.log(\"WebSocket connection established.\");\n  socket.send(\"Hello from client!\");\n};\n\nsocket.onmessage = (event) =&gt; {\n  console.log(\"Received message:\", event.data);\n};\n\nsocket.onclose = () =&gt; {\n  console.log(\"WebSocket connection closed.\");\n};<\/code><\/pre>\n\n\n\n<p>\u6bcf\u5f53\u4e00\u4e2a\u5ba2\u6237\u7aef\u5411 WebSocket \u670d\u52a1\u5668\u53d1\u9001\u6d88\u606f\u65f6\uff0c\u670d\u52a1\u5668\u4f1a\u5c06\u8be5\u6d88\u606f\u5e7f\u64ad\u7ed9\u6240\u6709\u5176\u4ed6\u8fde\u63a5\u7684\u5ba2\u6237\u7aef\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>14.3 \u5904\u7406 WebSocket \u5f02\u5e38<\/strong><\/h2>\n\n\n\n<p>\u5728\u4f7f\u7528 WebSocket \u65f6\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u5e38\u89c1\u7684\u5f02\u5e38\uff0c\u5982\u5ba2\u6237\u7aef\u65ad\u5f00\u8fde\u63a5\u3002\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7 <code>try<\/code> \u548c <code>except<\/code> \u5757\u6765\u5904\u7406\u8fd9\u4e9b\u5f02\u5e38\uff0c\u5e76\u786e\u4fdd\u670d\u52a1\u5668\u80fd\u591f\u7ee7\u7eed\u63a5\u53d7\u65b0\u7684\u8fde\u63a5\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@app.websocket(\"\/ws\/chat\")\nasync def chat_websocket(websocket: WebSocket):\n    await websocket.accept()\n    clients.append(websocket)\n    try:\n        while True:\n            message = await websocket.receive_text()\n            for client in clients:\n                if client != websocket:\n                    await client.send_text(message)\n    except WebSocketDisconnect:\n        clients.remove(websocket)\n        print(\"A client disconnected\")<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>14.3.1 \u8d85\u65f6\u63a7\u5236<\/strong><\/h3>\n\n\n\n<p>\u6709\u65f6 WebSocket \u8fde\u63a5\u53ef\u80fd\u4f1a\u56e0\u4e3a\u7f51\u7edc\u95ee\u9898\u6216\u8005\u5ba2\u6237\u7aef\u5173\u95ed\u7b49\u539f\u56e0\u88ab\u65ad\u5f00\u3002\u53ef\u4ee5\u8bbe\u5b9a\u8d85\u65f6\u65f6\u95f4\uff0c\u5728\u8fde\u63a5\u8d85\u65f6\u540e\u81ea\u52a8\u65ad\u5f00\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import asyncio\n\n@app.websocket(\"\/ws\/chat\")\nasync def chat_websocket(websocket: WebSocket):\n    await websocket.accept()\n    clients.append(websocket)\n    try:\n        while True:\n            message = await asyncio.wait_for(websocket.receive_text(), timeout=60)\n            for client in clients:\n                if client != websocket:\n                    await client.send_text(message)\n    except asyncio.TimeoutError:\n        print(\"WebSocket timeout\")\n    except WebSocketDisconnect:\n        clients.remove(websocket)\n        print(\"A client disconnected\")<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>14.4 \u6269\u5c55 WebSocket \u670d\u52a1<\/strong><\/h2>\n\n\n\n<p>WebSocket \u4e5f\u53ef\u4ee5\u7528\u4e8e\u591a\u79cd\u5b9e\u65f6\u5e94\u7528\uff0c\u9664\u4e86\u804a\u5929\u529f\u80fd\uff0c\u8fd8\u53ef\u4ee5\u7528\u4e8e\u4ee5\u4e0b\u5e94\u7528\u573a\u666f\uff1a<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>14.4.1 \u5b9e\u65f6\u901a\u77e5\u7cfb\u7edf<\/strong><\/h3>\n\n\n\n<p>\u53ef\u4ee5\u5c06 WebSocket \u7528\u4e8e\u63a8\u9001\u5b9e\u65f6\u901a\u77e5\u3002\u4f8b\u5982\uff0c\u521b\u5efa\u4e00\u4e2a\u7528\u4e8e\u63a8\u9001\u901a\u77e5\u7684 WebSocket \u670d\u52a1\uff0c\u6bcf\u5f53\u6709\u65b0\u7684\u901a\u77e5\u65f6\uff0c\u670d\u52a1\u5668\u5c31\u4f1a\u5c06\u901a\u77e5\u6d88\u606f\u53d1\u9001\u7ed9\u8fde\u63a5\u7684\u5ba2\u6237\u7aef\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@app.websocket(\"\/ws\/notifications\")\nasync def notification_websocket(websocket: WebSocket):\n    await websocket.accept()\n    while True:\n        # \u6a21\u62df\u53d1\u9001\u901a\u77e5\n        await websocket.send_text(\"You have a new notification!\")\n        await asyncio.sleep(10)  # \u6bcf 10 \u79d2\u53d1\u9001\u4e00\u6b21\u901a\u77e5<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>14.4.2 \u5b9e\u65f6\u6e38\u620f\u6216\u534f\u4f5c\u5e94\u7528<\/strong><\/h3>\n\n\n\n<p>WebSocket \u53ef\u4ee5\u7528\u4e8e\u591a\u73a9\u5bb6\u5b9e\u65f6\u6e38\u620f\u6216\u534f\u4f5c\u5e94\u7528\uff0c\u670d\u52a1\u5668\u53ef\u4ee5\u4fdd\u6301\u8fde\u63a5\u5e76\u540c\u6b65\u4e0d\u540c\u5ba2\u6237\u7aef\u4e4b\u95f4\u7684\u6e38\u620f\u72b6\u6001\u6216\u6570\u636e\u3002\u6bcf\u5f53\u67d0\u4e2a\u73a9\u5bb6\u64cd\u4f5c\u65f6\uff0c\u670d\u52a1\u5668\u4f1a\u5c06\u53d8\u5316\u53d1\u9001\u7ed9\u5176\u4ed6\u73a9\u5bb6\uff0c\u4fdd\u6301\u5b9e\u65f6\u6027\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>14.5 \u4f7f\u7528 WebSocket \u5b9e\u73b0\u5f02\u6b65\u6d41\u5a92\u4f53<\/strong><\/h2>\n\n\n\n<p>WebSocket \u4e5f\u53ef\u4ee5\u7528\u4e8e\u5b9e\u65f6\u89c6\u9891\u6d41\u3001\u97f3\u9891\u6d41\u6216\u5176\u4ed6\u591a\u5a92\u4f53\u5185\u5bb9\u7684\u4f20\u8f93\u3002\u867d\u7136 WebSocket \u672c\u8eab\u4e0d\u76f4\u63a5\u652f\u6301\u6d41\u5a92\u4f53\u4f20\u8f93\uff0c\u4f46\u53ef\u4ee5\u5229\u7528\u5176\u5168\u53cc\u5de5\u7279\u6027\u6765\u5b9e\u73b0\u4e00\u4e2a\u7b80\u5355\u7684\u89c6\u9891\u804a\u5929\u5e94\u7528\u3002\u4f8b\u5982\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u5ba2\u6237\u7aef\u901a\u8fc7 WebSocket \u5c06\u89c6\u9891\u6d41\u7684\u6bcf\u4e00\u5e27\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002<\/li>\n\n\n\n<li>\u670d\u52a1\u5668\u5c06\u63a5\u6536\u5230\u7684\u89c6\u9891\u6d41\u8f6c\u53d1\u7ed9\u5176\u4ed6\u8fde\u63a5\u7684\u5ba2\u6237\u7aef\uff0c\u8fbe\u5230\u89c6\u9891\u804a\u5929\u7684\u76ee\u7684\u3002<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>@app.websocket(\"\/ws\/video_stream\")\nasync def video_stream(websocket: WebSocket):\n    await websocket.accept()\n    try:\n        while True:\n            frame = await websocket.receive_bytes()  # \u63a5\u6536\u89c6\u9891\u5e27\n            for client in clients:\n                if client != websocket:\n                    await client.send_bytes(frame)  # \u53d1\u9001\u89c6\u9891\u5e27\u5230\u5176\u4ed6\u5ba2\u6237\u7aef\n    except WebSocketDisconnect:\n        clients.remove(websocket)<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>14.6 \u6027\u80fd\u4f18\u5316\u4e0e\u9ad8\u5e76\u53d1\u5904\u7406<\/strong><\/h2>\n\n\n\n<p>WebSocket \u670d\u52a1\u53ef\u80fd\u4f1a\u9047\u5230\u9ad8\u5e76\u53d1\u8bbf\u95ee\u95ee\u9898\uff0c\u56e0\u6b64\u9700\u8981\u8fdb\u884c\u4e00\u4e9b\u6027\u80fd\u4f18\u5316\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>14.6.1 \u8fde\u63a5\u6c60\u4e0e\u8d1f\u8f7d\u5747\u8861<\/strong><\/h3>\n\n\n\n<p>\u4e3a\u4e86\u5904\u7406\u5927\u91cf WebSocket \u8fde\u63a5\uff0c\u53ef\u4ee5\u4f7f\u7528\u8fde\u63a5\u6c60\u6280\u672f\u5c06\u8fde\u63a5\u5206\u914d\u5230\u4e0d\u540c\u7684\u670d\u52a1\u5668\u8282\u70b9\uff0c\u540c\u65f6\u5229\u7528\u8d1f\u8f7d\u5747\u8861\u5668\uff08\u5982 Nginx\uff09\u6765\u5206\u914d\u6d41\u91cf\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>14.6.2 \u6d88\u606f\u961f\u5217\u4e0e\u540e\u53f0\u4efb\u52a1<\/strong><\/h3>\n\n\n\n<p>\u5f53\u6d88\u606f\u91cf\u8f83\u5927\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528\u6d88\u606f\u961f\u5217\uff08\u5982 RabbitMQ \u6216 Kafka\uff09\u6765\u7f13\u89e3 WebSocket \u670d\u52a1\u5668\u7684\u538b\u529b\u3002\u5c06\u6d88\u606f\u63a8\u9001\u5230\u6d88\u606f\u961f\u5217\u4e2d\uff0c\u7136\u540e\u7531\u540e\u53f0\u5de5\u4f5c\u8fdb\u7a0b\u5f02\u6b65\u5904\u7406\uff0c\u6700\u540e\u518d\u5c06\u7ed3\u679c\u901a\u8fc7 WebSocket \u63a8\u9001\u5230\u5ba2\u6237\u7aef\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>\u603b\u7ed3\uff1a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>WebSocket<\/strong> \u534f\u8bae\u9002\u5408\u5b9e\u65f6\u6570\u636e\u4ea4\u6362\uff0c\u652f\u6301\u5168\u53cc\u5de5\u901a\u4fe1\u3002<\/li>\n\n\n\n<li>\u4f7f\u7528 <strong>FastAPI<\/strong> \u548c <strong>WebSocket<\/strong> \u53ef\u4ee5\u8f7b\u677e\u6784\u5efa\u9ad8\u6548\u7684\u5b9e\u65f6\u804a\u5929\u3001\u901a\u77e5\u63a8\u9001\u7b49\u5e94\u7528\u3002<\/li>\n\n\n\n<li>\u901a\u8fc7\u5408\u7406\u7684\u5f02\u5e38\u5904\u7406\u3001\u8d85\u65f6\u63a7\u5236\u548c\u4f18\u5316\u63aa\u65bd\uff0c\u53ef\u4ee5\u6784\u5efa\u9ad8\u6027\u80fd\u7684 WebSocket \u670d\u52a1\u3002<\/li>\n\n\n\n<li>WebSocket \u8fd8\u53ef\u4ee5\u6269\u5c55\u5230\u5b9e\u65f6\u6e38\u620f\u3001\u89c6\u9891\u6d41\u3001\u591a\u5a92\u4f53\u5e94\u7528\u7b49\u590d\u6742\u573a\u666f\u3002<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>\u4e0b\u7bc7\u6587\u7ae0\u6211\u4eec\u5c06\u63a2\u8ba8\u5982\u4f55\u5c06 WebSocket \u4e0e\u6570\u636e\u5e93\u6216\u5176\u4ed6\u540e\u7aef\u670d\u52a1\u7ed3\u5408\uff0c\u63d0\u5347\u5e94\u7528\u7684\u529f\u80fd\u548c\u6027\u80fd\uff01<\/strong> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>WebSocket \u662f\u4e00\u79cd\u5168\u53cc\u5de5\u901a\u4fe1\u534f\u8bae\uff0c\u5141\u8bb8\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\u4e4b\u95f4\u5b9e\u65f6\u5730\u8fdb\u884c\u6570\u636e\u4ea4\u6362\u3002\u4e0e HTTP \u534f\u8bae\u4e0d\u540c\uff0cW [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2852,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[79],"tags":[],"class_list":["post-2851","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python-3-"],"_links":{"self":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/2851","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/comments?post=2851"}],"version-history":[{"count":1,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/2851\/revisions"}],"predecessor-version":[{"id":2853,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/2851\/revisions\/2853"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/media\/2852"}],"wp:attachment":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/media?parent=2851"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/categories?post=2851"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/tags?post=2851"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}