{"id":59306,"date":"2026-01-13T16:34:28","date_gmt":"2026-01-13T08:34:28","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/59306.html"},"modified":"2026-01-13T16:34:28","modified_gmt":"2026-01-13T08:34:28","slug":"%e3%80%90sse%e5%ae%9e%e6%88%98%e3%80%91%ef%bc%9a%e6%8b%92%e7%bb%9d%e8%bd%ae%e8%af%a2%ef%bc%81%e4%b8%80%e5%a5%97%e4%bb%a3%e7%a0%81%e5%90%83%e9%80%8f-sse%ef%bc%88%e7%94%a8%e3%80%8cfetcheventsource","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/59306.html","title":{"rendered":"\u3010SSE\u5b9e\u6218\u3011\uff1a\u62d2\u7edd\u8f6e\u8be2\uff01\u4e00\u5957\u4ee3\u7801\u5403\u900f SSE!\uff08\u7528\u300cfetchEventSource\u300d\u4e00\u628a\u68ad\u641e\u5b9a SSE \u5b9e\u65f6\u63a8\u6d41\uff09"},"content":{"rendered":"<p id=\"main-toc\">\u76ee\u5f55<\/p>\n<p id=\"%E7%AC%AC%E4%B8%80%E7%AB%A0%20%E5%89%8D%E8%A8%80-toc\" style=\"margin-left:0px\">\u7b2c\u4e00\u7ae0 \u524d\u8a00<\/p>\n<p id=\"%E7%AC%AC%E4%BA%8C%E7%AB%A0%20%E5%87%86%E5%A4%87%E5%B7%A5%E4%BD%9C-toc\" style=\"margin-left:0px\">\u7b2c\u4e8c\u7ae0 \u51c6\u5907\u5de5\u4f5c<\/p>\n<p id=\"2.1%C2%A0SSE%20%E5%8D%8F%E8%AE%AE%E5%88%B0%E5%BA%95%E8%A7%84%E5%AE%9A%E4%BA%86%E5%95%A5-toc\" style=\"margin-left:40px\">2.1\u00a0SSE \u534f\u8bae\u5230\u5e95\u89c4\u5b9a\u4e86\u5565<\/p>\n<p id=\"2.2%C2%A0SSE%20%E4%B8%93%E5%B1%9E%E7%9A%84%E2%80%9C%E7%9B%B4%E6%92%AD%E7%9B%91%E6%8E%A7%E5%8F%B0%E2%80%9D-toc\" style=\"margin-left:40px\">2.2\u00a0SSE \u4e13\u5c5e\u7684\u201c\u76f4\u64ad\u76d1\u63a7\u53f0\u201d<\/p>\n<p id=\"2.3%C2%A0fetchEventSource%E5%BA%93-toc\" style=\"margin-left:40px\">2.3\u00a0fetchEventSource\u5e93<\/p>\n<p id=\"2.4%C2%A0%E5%8E%9F%E7%94%9F%20EventSource-toc\" style=\"margin-left:40px\">2.4\u00a0\u539f\u751f EventSource<\/p>\n<p id=\"%E7%AC%AC%E4%B8%89%E7%AB%A0%20%E5%AE%9E%E6%88%98-toc\" style=\"margin-left:0px\">\u7b2c\u4e09\u7ae0 \u5b9e\u6218<\/p>\n<p id=\"3.1%20%E5%B0%81%E8%A3%85hooks%EF%BC%8C%E5%BB%BA%E7%AB%8B%E8%BF%9E%E6%8E%A5-toc\" style=\"margin-left:40px\">3.1 \u5c01\u88c5hooks&#xff0c;\u5efa\u7acb\u8fde\u63a5<\/p>\n<p id=\"3.2%20%E4%BD%BF%E7%94%A8-toc\" style=\"margin-left:40px\">3.2 \u4f7f\u7528<\/p>\n<p id=\"3.3%C2%A0%E4%BA%8B%E4%BB%B6%E5%88%86%E5%8F%91-toc\" style=\"margin-left:40px\">3.3\u00a0\u4e8b\u4ef6\u5206\u53d1<\/p>\n<p id=\"3.4%C2%A0%E5%BC%82%E5%B8%B8%E4%B8%8E%E9%87%8D%E8%BF%9E-toc\" style=\"margin-left:40px\">3.4\u00a0\u5f02\u5e38\u4e0e\u91cd\u8fde<\/p>\n<p id=\"3.5%C2%A0%E9%A1%B5%E9%9D%A2%E5%8D%B8%E8%BD%BD%E6%97%B6%E6%B8%85%E7%90%86-toc\" style=\"margin-left:40px\">3.5\u00a0\u9875\u9762\u5378\u8f7d\u65f6\u6e05\u7406<\/p>\n<p id=\"3.6%C2%A0%E5%AE%89%E5%85%A8%E4%B8%8E%E6%80%A7%E8%83%BD-toc\" style=\"margin-left:40px\">3.6\u00a0\u5b89\u5168\u4e0e\u6027\u80fd<\/p>\n<p id=\"%E7%AC%AC%E5%9B%9B%E7%AB%A0%20%E6%80%BB%E7%BB%93-toc\" style=\"margin-left:0px\">\u7b2c\u56db\u7ae0 \u603b\u7ed3<\/p>\n<hr id=\"hr-toc\" \/>\n<\/p>\n<h2 id=\"%E7%AC%AC%E4%B8%80%E7%AB%A0%20%E5%89%8D%E8%A8%80\">\u7b2c\u4e00\u7ae0 \u524d\u8a00<\/h2>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u6700\u8fd1\u9047\u5230\u4e00\u4e2a\u524d\u4eba\u5199\u7684\u9700\u6c42\u5f88\u8499\u5708&#xff1b;\u4e3a\u4e86\u5b9e\u73b0\u4e00\u4e2a\u72b6\u6001\u7684\u5b9e\u65f6\u53d8\u5316&#xff1a;\u5982\u540e\u53f0\u6709\u6570\u636e\u7684\u72b6\u6001\u66f4\u65b0\u4e86\u9700\u8981\u524d\u7aef\u5237\u65b0\u6570\u636e&#xff0c;\u4e8e\u662f\u524d\u7aef\u5c31\u7528setInterval\u5199\u4e86\u4e00\u4e2a\u6bcf\u96945s\u5237\u65b0\u4e00\u4e0b\u6570\u636e\u5217\u8868&#xff0c;\u5982\u679c\u7528\u6237\u8fd8\u8fdb\u884c\u4e86\u67d0\u4e9b\u64cd\u4f5c&#xff0c;\u518d\u7f13\u5b58\u4e00\u4efd&#xff0c;\u5f53\u6570\u636e\u5237\u65b0\u4e86\u4e4b\u540e\u518d\u8fd8\u539f\u56de\u6765&#xff0c;\u7ed9\u5ba2\u6237\u4e00\u79cd\u65e0\u611f\u7684\u611f\u89c9&#xff1b;\u5f53\u770b\u5230\u8fd9\u5757\u4ee3\u7801\u5c31\u5f88\u61f5\u5708\u5440&#xff01;\u5c31\u4e3a\u4e86\u4e00\u4e2a\u90a3\u6837\u7684\u9700\u6c42&#xff0c;\u5c31\u7528\u00a0setInterval \u5237\u65b0\u6570\u636e&#xff1f;\u592a\u6389\u4ef7\u4e86&#xff01;\u5bfc\u81f4\u9875\u9762\u57fa\u672c\u4e0a\u90fd\u5728\u5411\u670d\u52a1\u5668\u8bf7\u6c42\u6570\u636e&#xff0c;\u670d\u52a1\u5668\u538b\u529b\u5927&#xff0c;\u524d\u7aef\u4e5f\u6709\u4e00\u70b9\u8d85\u7ea7\u65e0\u654c\u5361&#xff01;\u79c9\u627f\u7740\u51d1\u5408\u7740\u7528\u662f\u5427&#xff01;<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u5c0f\u7f16\u4e3a\u4e86\u5904\u7406\u4e0a\u9762\u90a3\u9700\u6c42&#xff0c;\u4e3a\u4e86\u4f18\u5316\u8fd9\u5757\u5185\u5bb9&#xff0c;\u5c31\u8ddf\u540e\u7aef\u5546\u91cf\u597d&#xff0c;\u51b3\u5b9a\u4f7f\u7528SSE\u5904\u7406\u8fd9\u4e2a\u529f\u80fd&#xff01;\u4e0b\u9762\u662f\u5c0f\u7f16\u5904\u7406\u7684\u76f8\u5173\u57fa\u672c\u4ee3\u7801&#xff08;\u6ce8\u610f&#xff01;\u4e0d\u662f\u5177\u4f53\u529f\u80fd\u7684\u54df&#xff01;&#xff09;<\/p>\n<h2 id=\"%E7%AC%AC%E4%BA%8C%E7%AB%A0%20%E5%87%86%E5%A4%87%E5%B7%A5%E4%BD%9C\">\u7b2c\u4e8c\u7ae0 \u51c6\u5907\u5de5\u4f5c<\/h2>\n<p>\u9488\u5bf9SSE&#xff0c;\u5c0f\u7f16\u8981\u5e26\u5927\u5bb6\u4e0b\u8ba4\u8bc6\u51e0\u4e2a\u5de5\u5177&#xff0c;\u65b9\u4fbf\u4e4b\u540e\u5bf9\u63a5\u65f6\u7684\u8c03\u8bd5\u2026\u2026<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"780\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260113083426-69660392aa0ef.png\" width=\"1224\" \/><\/p>\n<h3 id=\"2.1%C2%A0SSE%20%E5%8D%8F%E8%AE%AE%E5%88%B0%E5%BA%95%E8%A7%84%E5%AE%9A%E4%BA%86%E5%95%A5\">2.1\u00a0SSE \u534f\u8bae\u5230\u5e95\u89c4\u5b9a\u4e86\u5565<\/h3>\n<ul>\n<li>HTTP \u957f\u8fde\u63a5<\/li>\n<\/ul>\n<p>\u54cd\u5e94\u5934\u5fc5\u987b\u5e26&#xff1a;<\/p>\n<p>Content-Type: text\/event-stream <\/p>\n<p>\u8bf7\u6c42\u5934\u5fc5\u987b\u6709&#xff1a;<\/p>\n<p>Accept: text\/event-stream <\/p>\n<ul>\n<li>\n<p>\u4e4b\u540e\u670d\u52a1\u5668\u4fdd\u6301 TCP \u4e0d\u65ad&#xff0c;\u6309\u683c\u5f0f\u5410\u6587\u672c&#xff1a;<\/p>\n<\/li>\n<\/ul>\n<p>event: message<br \/>\ndata: {&#034;id&#034;:1,&#034;amount&#034;:99}<br \/>\nid:1001<br \/>\nretry: 5000<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"184\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260113083427-6966039317b86.png\" width=\"596\" \/><\/p>\n<ul>\n<li>\u6d4f\u89c8\u5668\u539f\u751f\u80fd\u529b<\/li>\n<\/ul>\n<li>\u9047\u5230 \\\\n\\\\n \u89e6\u53d1\u4e00\u6b21\u4e8b\u4ef6<\/li>\n<li>\u65ad\u7f51\u540e\u81ea\u52a8\u91cd\u8fde&#xff0c;\u5e76\u5e26\u4e0a Last-Event-ID<\/li>\n<li>\u53ef\u8c03\u6574\u91cd\u8fde\u95f4\u9694 retry:&#xff08;\u9ed8\u8ba4 3s \u2192 \u6307\u6570\u9000\u907f&#xff09;<\/li>\n<h3 id=\"2.2%C2%A0SSE%20%E4%B8%93%E5%B1%9E%E7%9A%84%E2%80%9C%E7%9B%B4%E6%92%AD%E7%9B%91%E6%8E%A7%E5%8F%B0%E2%80%9D\">2.2\u00a0SSE \u4e13\u5c5e\u7684\u201c\u76f4\u64ad\u76d1\u63a7\u53f0\u201d<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"210\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260113083427-69660393290d3.png\" width=\"916\" \/><\/p>\n<ul>\n<li>EventStream \u5c31\u662f Chrome DevTools \u2192 Network \u9762\u677f \u91cc\u4e13\u95e8\u7528\u6765<span style=\"color:#fe2c24\">\u53ef\u89c6\u5316 SSE&#xff08;text\/event-stream&#xff09;\u957f\u8fde\u63a5<\/span>\u7684\u8c03\u8bd5\u680f\u3002<\/li>\n<li>\u53ea\u8981<span style=\"color:#fe2c24\">\u54cd\u5e94\u5934\u5305\u542b Content-Type: text\/event-stream<\/span> Chrome \u5c31\u4f1a\u628a\u8fd9\u6761\u8bf7\u6c42\u81ea\u52a8\u5f52\u7c7b\u5230 EventStream \u6807\u7b7e\u9875&#xff08;\u800c\u4e0d\u662f\u5e38\u89c4\u7684 Response\/Preview&#xff09;\u3002<\/li>\n<li>\u5728\u91cc\u9762\u53ef\u4ee5&#xff1a; \u5b9e\u65f6\u770b\u5230\u670d\u52a1\u5668\u4e00\u6761\u6761 push \u8fc7\u6765\u7684\u4e8b\u4ef6&#xff08;data: \/ event: \/ id:&#xff09;&#xff1b; \u68c0\u67e5\u65ad\u7ebf\u91cd\u8fde\u662f\u5426\u5e26 Last-Event-ID&#xff1b; \u8fc7\u6ee4\u5fc3\u8df3\u3001\u7edf\u8ba1\u5ef6\u8fdf\u3001\u590d\u5236\u539f\u59cb\u62a5\u6587\u3002<\/li>\n<\/ul>\n<h3 id=\"2.3%C2%A0fetchEventSource%E5%BA%93\">2.3\u00a0fetchEventSource\u5e93<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"110\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260113083427-696603933e62b.png\" width=\"730\" \/><\/p>\n<p>\u524d\u7aef\u95ee&#xff1a;\u4e3a\u4ec0\u4e48\u5f88\u591a\u65f6\u5019\u4ee3\u7801\u91cc\u770b\u4e0d\u5230\u643a\u5e26\u4e86text\/event-stream&#xff0c;\u4f46\u662f\u5f53\u6211\u4eec\u770b\u8bf7\u6c42\u5934\u7684\u65f6\u5019\u53c8\u4f1a\u6709\u5462&#xff1f;\u5982\u4e0b\u4ee3\u7801&#xff1a;<\/p>\n<p>import { fetchEventSource } from &#039;&#064;microsoft\/fetch-event-source&#039;<\/p>\n<p>await fetchEventSource(&#039;\/api\/***\/****&#039;, {<br \/>\n  method: &#039;POST&#039;,<br \/>\n  headers: { &#039;Content-Type&#039;: &#039;application\/json&#039; },<br \/>\n  body: JSON.stringify({ userId: 123 }),<br \/>\n  onmessage(msg) { console.log(msg.data) }<br \/>\n}) <\/p>\n<p>\u56de\u7b54&#xff1a;\u662f\u8fd9\u4e2a\u5e93\u5728\u80cc\u540e\u5077\u5077\u5e72\u4e86\u4e09\u4ef6\u4e8b&#xff1a;<\/p>\n<li><span style=\"color:#fe2c24\">\u81ea\u52a8\u8ffd\u52a0\u8bf7\u6c42\u5934 Accept: text\/event-stream<\/span><\/li>\n<li><span style=\"color:#fe2c24\">\u6821\u9a8c\u54cd\u5e94\u5934<\/span>\u5fc5\u987b\u662f Content-Type: text\/event-stream&#xff0c;\u5426\u5219\u629b\u9519<\/li>\n<li><span style=\"color:#fe2c24\">\u6309 SSE \u683c\u5f0f\u9010\u6bb5\u89e3\u6790\u5e76\u56de\u8c03 onmessage \/ onerror \/ onclose<\/span><\/li>\n<p>\u56e0\u6b64&#xff1a;<span style=\"color:#ff9900\">\u300c\u524d\u7aef\u7528\u4e86\u8fd9\u4e2a\u5e93\u4e4b\u540e\u4ee3\u7801\u5c42\u9762\u300d\u770b\u4e0d\u5230 event-stream&#xff0c;\u300c\u534f\u8bae\u5c42\u9762\u300d\u4ecd\u5728\u4e25\u683c\u9075\u5b88 SSE \u89c4\u8303<\/span>\u3002 \u8fd9\u4e5f\u89e3\u91ca\u4e86\u4e3a\u4f55 Chrome \u4f9d\u7136\u628a\u5b83\u6536\u8fdb EventStream \u680f\u3002<\/p>\n<h3 id=\"2.4%C2%A0%E5%8E%9F%E7%94%9F%20EventSource\">2.4\u00a0\u539f\u751f EventSource<\/h3>\n<p>\u4e0d\u4f7f\u7528\u539f\u751fEventSource\u7684\u539f\u56e0&#xff0c;\u4e09\u5927\u75db\u70b9&#xff1a;<\/p>\n<li>\u53ea\u80fd GET&#xff0c;\u4e0d\u80fd\u5e26 body&#xff1b;<\/li>\n<li>\u4e0d\u80fd\u81ea\u5b9a\u4e49\u5934&#xff08;\u5982 Authorization&#xff09;&#xff1b;<\/li>\n<li>\u4e0d\u80fd\u4e3b\u52a8 cancel\u3002<\/li>\n<h2 id=\"%E7%AC%AC%E4%B8%89%E7%AB%A0%20%E5%AE%9E%E6%88%98\">\u7b2c\u4e09\u7ae0 \u5b9e\u6218<\/h2>\n<h3 id=\"3.1%20%E5%B0%81%E8%A3%85hooks%EF%BC%8C%E5%BB%BA%E7%AB%8B%E8%BF%9E%E6%8E%A5\">3.1 \u5c01\u88c5hooks&#xff0c;\u5efa\u7acb\u8fde\u63a5<\/h3>\n<p>\/**<br \/>\n * SSE (Server-Sent Events) Hook<br \/>\n * \u7528\u4e8e\u5728 Vue \u7ec4\u4ef6\u4e2d\u7ba1\u7406 SSE \u8fde\u63a5<br \/>\n *\/<br \/>\nimport { ref } from &#039;vue&#039;<br \/>\nimport { fetchEventSource } from &#039;&#064;microsoft\/fetch-event-source&#039;<br \/>\nimport _c from &#039;&#064;\/config\/index&#039;<\/p>\n<p>\/**<br \/>\n * SSE \u8fde\u63a5\u7ba1\u7406 Hook<br \/>\n * &#064;returns {Object} \u5305\u542b\u63a7\u5236\u5668\u548c SSE \u64cd\u4f5c\u65b9\u6cd5\u7684\u5bf9\u8c61<br \/>\n *\/<br \/>\nexport function useSse() {<br \/>\n  \/\/ \u7528\u4e8e\u7ba1\u7406 SSE \u8fde\u63a5\u7684\u63a7\u5236\u5668\u5b9e\u4f8b<br \/>\n  const controller &#061; ref(null)<\/p>\n<p>  \/**<br \/>\n   * \u542f\u52a8 SSE \u8fde\u63a5<br \/>\n   * &#064;param {Object} data &#8211; \u53d1\u9001\u7ed9\u670d\u52a1\u5668\u7684\u8bf7\u6c42\u6570\u636e<br \/>\n   * &#064;param {Function} callBack &#8211; \u63a5\u6536 SSE \u6d88\u606f\u7684\u56de\u8c03\u51fd\u6570<br \/>\n   *\/<br \/>\n  async function startSSE(data, callBack, url) {<br \/>\n    \/\/ \u521b\u5efa\u65b0\u7684 AbortController \u5b9e\u4f8b<br \/>\n    controller.value &#061; new AbortController()<\/p>\n<p>    \/\/ \u5efa\u7acb SSE \u8fde\u63a5<br \/>\n    fetchEventSource(_c.baseApiPrefix &#043; url, {<br \/>\n      method: &#039;POST&#039;,<br \/>\n      headers: {<br \/>\n        &#039;Content-Type&#039;: &#039;application\/json&#039;<br \/>\n      },<br \/>\n      \/\/ \u8bf7\u6c42\u4f53\u6570\u636e&#xff0c;\u8f6c\u6362\u4e3a JSON \u5b57\u7b26\u4e32<br \/>\n      body: JSON.stringify(data),<br \/>\n      \/\/ \u7528\u4e8e\u7ec8\u6b62\u8fde\u63a5\u7684\u4fe1\u53f7<br \/>\n      signal: controller.value.signal,<br \/>\n      \/\/ \u7981\u6b62\u540e\u53f0\u91cd\u8fde<br \/>\n      openWhenHidden: false,<br \/>\n      \/\/ \u8fde\u63a5\u5efa\u7acb\u65f6\u7684\u56de\u8c03<br \/>\n      onopen() {<br \/>\n        console.log(&#039;\u5efa\u7acb\u8fde\u63a5\u7684\u56de\u8c03&#039;)<br \/>\n      },<br \/>\n      \/\/ \u8fde\u63a5\u5173\u95ed\u65f6\u7684\u56de\u8c03<br \/>\n      onclose() {<br \/>\n        console.log(&#039;\u5173\u95ed\u8fde\u63a5\u7684\u56de\u8c03&#039;)<br \/>\n        \/\/ \u5173\u95ed SSE \u8fde\u63a5<br \/>\n        closeSSE()<br \/>\n      },<br \/>\n      \/\/ \u63a5\u6536\u6d88\u606f\u65f6\u7684\u56de\u8c03<br \/>\n      onmessage(msg) {<br \/>\n        console.log(&#039;\u6536\u5230 SSE \u6d88\u606f:&#039;, msg)<br \/>\n        \/\/ \u89e3\u6790 JSON \u6570\u636e\u5e76\u4f20\u9012\u7ed9\u56de\u8c03\u51fd\u6570<br \/>\n        callBack(JSON.parse(msg.data))<br \/>\n      },<br \/>\n      \/\/ \u8fde\u63a5\u9519\u8bef\u65f6\u7684\u56de\u8c03<br \/>\n      onerror(err) {<br \/>\n        \/\/ \u901a\u77e5\u56de\u8c03\u51fd\u6570\u53d1\u751f\u9519\u8bef<br \/>\n        callBack({ event: &#039;error&#039;, data: err })<br \/>\n        \/\/ \u5173\u95ed SSE \u8fde\u63a5<br \/>\n        closeSSE()<br \/>\n        \/\/ \u629b\u51fa\u9519\u8bef<br \/>\n        throw err<br \/>\n      }<br \/>\n    })<br \/>\n  }<\/p>\n<p>  \/**<br \/>\n   * \u5173\u95ed SSE \u8fde\u63a5<br \/>\n   *\/<br \/>\n  function closeSSE() {<br \/>\n    if (controller.value) {<br \/>\n      \/\/ \u7ec8\u6b62\u5f53\u524d\u8fde\u63a5<br \/>\n      controller.value.abort()<br \/>\n      \/\/ \u6e05\u7a7a\u63a7\u5236\u5668\u5f15\u7528<br \/>\n      controller.value &#061; null<br \/>\n    }<br \/>\n  }<\/p>\n<p>  \/\/ \u8fd4\u56de\u63a7\u5236\u5668\u548c\u64cd\u4f5c\u65b9\u6cd5<br \/>\n  return {<br \/>\n    controller,<br \/>\n    startSSE,<br \/>\n    closeSSE<br \/>\n  }<br \/>\n}<\/p>\n<p>\u89e3\u91ca&#xff1a;<\/p>\n<p>controller &#061; new AbortController();<br \/>\nawait fetchEventSource(url, {<br \/>\n  method: &#039;POST&#039;,<br \/>\n  headers: { &#039;Content-Type&#039;: &#039;application\/json&#039; },<br \/>\n  body: JSON.stringify(data),<br \/>\n  signal: controller.signal,<br \/>\n  openWhenHidden: false   \/\/ \u5207\u540e\u53f0\u5c31\u6682\u505c&#xff0c;\u7701\u6d41\u91cf<br \/>\n}) <\/p>\n<ul>\n<li>\u7528 AbortController \u5b9e\u73b0\u201c\u53ef\u53d6\u6d88\u7684 Promise\u201d&#xff1b;<\/li>\n<li>\u628a\u4e1a\u52a1\u53c2\u6570&#xff08;\u67e5\u8be2\u6761\u4ef6\u3001\u7528\u6237 ID \u7b49&#xff09;\u653e\u5728 body&#xff0c;\u907f\u514d URL \u8fc7\u957f\u3002<\/li>\n<\/ul>\n<h3 id=\"3.2%20%E4%BD%BF%E7%94%A8\">3.2 \u4f7f\u7528<\/h3>\n<p>import { useSse } from &#039;&#064;\/hooks\/useSse&#039;<br \/>\nconst { startSSE } &#061; useSse()<\/p>\n<p>const chatList &#061; ref([])<\/p>\n<p>\/\/ \u524d\u7aef\u9700\u8981\u6a21\u62df\u95ee\u7b54\u65f6\u4e24\u79cd\u65b9\u5f0f\u7684\u5bf9\u8c61<br \/>\n\/\/\u95ee<br \/>\nchatList.value.push({<br \/>\n    mathId: new Date().getTime() &#043; Math.random(),<br \/>\n    type: &#039;ask&#039;,<br \/>\n    text: val,<br \/>\n    files: files<br \/>\n})<br \/>\n\/\/\u7b54<br \/>\nchatList.value.push({<br \/>\n    mathId: new Date().getTime() &#043; Math.random(),<br \/>\n    type: &#039;answer&#039;,<br \/>\n    answer: &#039;&#039;,<br \/>\n    thoughts: &#039;&#039;<br \/>\n})<\/p>\n<p>const setAnswer &#061; (obj) &#061;&gt; {<br \/>\n  switch (obj.event) {<br \/>\n    case &#039;message&#039;: {<br \/>\n      \/\/ \u5904\u7406\u540e\u7aef\u8fd4\u56demessage\u65f6\u7684\u903b\u8f91<br \/>\n      break<br \/>\n    }<br \/>\n    case &#039;message_end&#039;:<br \/>\n      \/\/ \u6d88\u606f\u7ed3\u675f\u65f6\u7684\u903b\u8f91<br \/>\n      break<br \/>\n  }<br \/>\n  \/\/ scrollToBottom()<br \/>\n} <\/p>\n<h3 id=\"3.3%C2%A0%E4%BA%8B%E4%BB%B6%E5%88%86%E5%8F%91\">3.3\u00a0\u4e8b\u4ef6\u5206\u53d1<\/h3>\n<p>\u540e\u7aef\u53ef\u4ee5\u53d1\u4e09\u79cd\u6807\u51c6\u4e8b\u4ef6&#xff1a;<\/p>\n<p>event: message        \u2192 onmessage \u9ed8\u8ba4<br \/>\nevent: ping           \u2192 \u5fc3\u8df3&#xff0c;\u524d\u7aef\u5ffd\u7565\u5373\u53ef<br \/>\nevent: message_end    \u2192 \u672c\u6b21\u6279\u6b21\u7684\u7ed3\u675f\u6807\u8bb0 <\/p>\n<p>\u524d\u7aef\u53ea\u9700\u8981\u9488\u5bf9\u4e8b\u4ef6\u7c7b\u578bmessage\u4e0emessage_end\u5904\u7406\u903b\u8f91\u5373\u53ef&#xff1b;\u5982\u679c\u53ef\u4ee5\u5de5\u5177\u7c7b\u7528 handlers[msg.event] \u505a map \u5206\u53d1&#xff0c;\u6bd4 if\/else \u6613\u6269\u5c55\u3002<\/p>\n<p>const handlers &#061; {<br \/>\n  message: () &#061;&gt; {<br \/>\n    try {<br \/>\n      callBack(JSON.parse(msg.data))<br \/>\n    } catch (e) {<br \/>\n      callBack({ event: &#039;error&#039;, data: &#039;Failed to parse message data&#039; })<br \/>\n    }<br \/>\n  },<br \/>\n  ping: () &#061;&gt; {},<br \/>\n  message_end: () &#061;&gt; {<br \/>\n    try {<br \/>\n      callBack(JSON.parse(msg.data))<br \/>\n    } catch (e) {<br \/>\n      callBack({ event: &#039;error&#039;, data: &#039;Failed to parse message_end data&#039; })<br \/>\n    }<br \/>\n  }<br \/>\n}<br \/>\nconst handler &#061; handlers[msg.event]<br \/>\nif (handler) {<br \/>\n  handler()<br \/>\n} <\/p>\n<h3 id=\"3.4%C2%A0%E5%BC%82%E5%B8%B8%E4%B8%8E%E9%87%8D%E8%BF%9E\">3.4\u00a0\u5f02\u5e38\u4e0e\u91cd\u8fde<\/h3>\n<p>fetchEventSource \u5185\u7f6e\u6307\u6570\u9000\u907f\u91cd\u8fde&#xff08;\u9ed8\u8ba4 3 s \u2192 6 s \u2192 12 s\u2026&#xff09;\u3002 \u6211\u4eec\u53ea\u9700\u5728 onerror \u91cc\u505a\u4e09\u4ef6\u4e8b&#xff1a;<\/p>\n<li>\u544a\u8bc9\u4e1a\u52a1\u5c42 {event:&#039;error&#039;}&#xff1b;<\/li>\n<li>closeSSE() \u6e05\u6389\u65e7\u8fde\u63a5&#xff1b;<\/li>\n<li>\u4e0d\u518d throw&#xff0c;\u5426\u5219\u63a7\u5236\u53f0\u4f1a\u51fa\u73b0 Uncaught Promise\u3002<\/li>\n<h3 id=\"3.5%C2%A0%E9%A1%B5%E9%9D%A2%E5%8D%B8%E8%BD%BD%E6%97%B6%E6%B8%85%E7%90%86\">3.5\u00a0\u9875\u9762\u5378\u8f7d\u65f6\u6e05\u7406<\/h3>\n<p>\u9632\u6b62\u5207\u8def\u7531\u540e\u540e\u53f0\u4ecd\u5360\u7528\u8fde\u63a5\u6570\u3002<\/p>\n<p>() &#061;&gt; closeSSE() <\/p>\n<h3 id=\"3.6%C2%A0%E5%AE%89%E5%85%A8%E4%B8%8E%E6%80%A7%E8%83%BD\">3.6\u00a0\u5b89\u5168\u4e0e\u6027\u80fd<\/h3>\n<ul>\n<li>\u9274\u6743&#xff1a;POST \u5934\u91cc\u5e26 Authorization: Bearer &lt;token&gt;&#xff0c;Spring \u6309\u5e38\u89c4\u62e6\u622a\u5668\u6821\u9a8c\u5373\u53ef&#xff1b;SSE \u8fde\u63a5\u4e00\u65e6 401&#xff0c;\u524d\u7aef onerror \u6536\u5230\u7acb\u523b\u8df3\u8f6c\u767b\u5f55\u9875\u3002<\/li>\n<\/ul>\n<p>\u00a0 &#8211; \u653e\u5728\u8bf7\u6c42\u4f53\u4e2d&#xff1a;<\/p>\n<p>headers: {<br \/>\n  &#039;Content-Type&#039;: &#039;application\/json&#039;,<br \/>\n  &#039;Authorization&#039;: &#039;Bearer &#039; &#043; (getToken() || &#039;test&#039;)<br \/>\n} <\/p>\n<p>&#8211; \u653e\u5728\u53c2\u6570\u4e2d&#xff1a;<\/p>\n<p> const data &#061; {<br \/>\n    userId: 123,<br \/>\n    inputs: {<br \/>\n      token: getToken() ? &#096;Bearer ${getToken()}&#096; : &#039;Bearer test&#039;<br \/>\n    },<br \/>\n    appKey: appKey.value,<br \/>\n    chatId: currentChatId.value,<br \/>\n    \u2026\u2026<br \/>\n} <\/p>\n<ul>\n<li>\u591a\u5b9e\u4f8b&#xff08;\u9488\u5bf9\u540e\u7aef\u7684&#xff09;&#xff1a;\u5185\u5b58 ConcurrentHashMap \u53ea\u5728\u672c\u673a\u6709\u6548\u3002\u4e0a\u751f\u4ea7\u6539\u7528 Redis \u53d1\u5e03\/\u8ba2\u9605\u6216 Kafka \u2192 \u6bcf\u4e2a\u5b9e\u4f8b\u53ea\u63a8\u81ea\u5df1\u5185\u5b58\u91cc\u7684\u4f1a\u8bdd\u3002<\/li>\n<li>\u9650\u6d41&#xff1a; \u5355\u4e2a\u6d4f\u89c8\u5668\u4f1a\u8bdd\u6700\u9ad8 1 \u6761\u8fde\u63a5&#xff1b;\u8d85\u51fa\u8fd4\u56de 429&#xff0c;\u524d\u7aef\u9000\u907f 5 s \u518d\u91cd\u8bd5\u3002<\/li>\n<li>\u538b\u7f29&#xff1a; \u4e8b\u4ef6\u4f53 &gt; 1 kB \u53ef\u5f00 gzip&#xff08;Nginx gzip_types text\/event-stream;&#xff09;&#xff0c;\u4f46\u5c0f\u6d88\u606f\u53cd\u800c\u589e\u52a0 CPU&#xff0c;\u6309\u9700\u5f00\u542f\u3002<\/li>\n<\/ul>\n<h2 id=\"%E7%AC%AC%E5%9B%9B%E7%AB%A0%20%E6%80%BB%E7%BB%93\">\u7b2c\u56db\u7ae0 \u603b\u7ed3<\/h2>\n<p>\u524d\u7aef fetchEventSource   \u81ea\u52a8 Accept: text\/event-stream<br \/>\n        \u2193 POST &#043; Token<br \/>\n\u540e\u7aef SseEmitter        \u54cd\u5e94 Content-Type: text\/event-stream<br \/>\n        \u2193 \u6570\u636e\u53d8\u66f4<br \/>\nChrome DevTools \u2192 EventStream \u680f\u5b9e\u65f6\u6eda\u52a8 <\/p>\n<ul>\n<li>\u5bf9\u4e8e\u524d\u7aef&#xff1a;\u4f7f\u7528fetchEventSource\u5e93&#xff0c;\u534f\u8bae\u6ca1\u53d8&#xff0c;\u53ea\u662f\u6362\u4e86\u66f4\u7075\u6d3b\u7684\u6572\u95e8\u65b9\u5f0f\u3002<\/li>\n<li>\u518d\u8005SSE \u7684&#034;\u5b9e\u65f6&#034;\u5173\u952e\u4e0d\u5728\u524d\u7aef&#xff0c;\u800c\u5728\u540e\u7aef\u5982\u4f55\u611f\u77e5\u6570\u636e\u53d8\u5316\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb225\u6b21\uff0c\u70b9\u8d5e6\u6b21\uff0c\u6536\u85cf4\u6b21\u3002\u672c\u6587\u63a2\u8ba8\u4e86\u5982\u4f55\u4f18\u5316\u524d\u7aef\u5b9e\u65f6\u6570\u636e\u66f4\u65b0\u65b9\u6848\uff0c\u5c06\u4f20\u7edf\u7684setInterval\u8f6e\u8be2\u6539\u4e3aSSE\uff08Server-Sent Events\uff09\u6280\u672f\u3002\u901a\u8fc7SSE\u6280\u672f\uff0c\u5b9e\u73b0\u4e86\u66f4\u9ad8\u6548\u7684\u6570\u636e\u5b9e\u65f6\u66f4\u65b0\uff0c\u540c\u65f6\u964d\u4f4e\u4e86\u670d\u52a1\u5668\u8d1f\u8f7d\u548c\u524d\u7aef\u6027\u80fd\u6d88\u8017\u3002<\/p>\n","protected":false},"author":2,"featured_media":59302,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"topic":[],"class_list":["post-59306","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u3010SSE\u5b9e\u6218\u3011\uff1a\u62d2\u7edd\u8f6e\u8be2\uff01\u4e00\u5957\u4ee3\u7801\u5403\u900f SSE!\uff08\u7528\u300cfetchEventSource\u300d\u4e00\u628a\u68ad\u641e\u5b9a SSE \u5b9e\u65f6\u63a8\u6d41\uff09 - \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\/59306.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u3010SSE\u5b9e\u6218\u3011\uff1a\u62d2\u7edd\u8f6e\u8be2\uff01\u4e00\u5957\u4ee3\u7801\u5403\u900f SSE!\uff08\u7528\u300cfetchEventSource\u300d\u4e00\u628a\u68ad\u641e\u5b9a SSE \u5b9e\u65f6\u63a8\u6d41\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb225\u6b21\uff0c\u70b9\u8d5e6\u6b21\uff0c\u6536\u85cf4\u6b21\u3002\u672c\u6587\u63a2\u8ba8\u4e86\u5982\u4f55\u4f18\u5316\u524d\u7aef\u5b9e\u65f6\u6570\u636e\u66f4\u65b0\u65b9\u6848\uff0c\u5c06\u4f20\u7edf\u7684setInterval\u8f6e\u8be2\u6539\u4e3aSSE\uff08Server-Sent Events\uff09\u6280\u672f\u3002\u901a\u8fc7SSE\u6280\u672f\uff0c\u5b9e\u73b0\u4e86\u66f4\u9ad8\u6548\u7684\u6570\u636e\u5b9e\u65f6\u66f4\u65b0\uff0c\u540c\u65f6\u964d\u4f4e\u4e86\u670d\u52a1\u5668\u8d1f\u8f7d\u548c\u524d\u7aef\u6027\u80fd\u6d88\u8017\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/59306.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-01-13T08:34:28+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260113083426-69660392aa0ef.png\" \/>\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=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/59306.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/59306.html\",\"name\":\"\u3010SSE\u5b9e\u6218\u3011\uff1a\u62d2\u7edd\u8f6e\u8be2\uff01\u4e00\u5957\u4ee3\u7801\u5403\u900f SSE!\uff08\u7528\u300cfetchEventSource\u300d\u4e00\u628a\u68ad\u641e\u5b9a SSE \u5b9e\u65f6\u63a8\u6d41\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-01-13T08:34:28+00:00\",\"dateModified\":\"2026-01-13T08:34:28+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/59306.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/59306.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/59306.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u3010SSE\u5b9e\u6218\u3011\uff1a\u62d2\u7edd\u8f6e\u8be2\uff01\u4e00\u5957\u4ee3\u7801\u5403\u900f SSE!\uff08\u7528\u300cfetchEventSource\u300d\u4e00\u628a\u68ad\u641e\u5b9a SSE \u5b9e\u65f6\u63a8\u6d41\uff09\"}]},{\"@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":"\u3010SSE\u5b9e\u6218\u3011\uff1a\u62d2\u7edd\u8f6e\u8be2\uff01\u4e00\u5957\u4ee3\u7801\u5403\u900f SSE!\uff08\u7528\u300cfetchEventSource\u300d\u4e00\u628a\u68ad\u641e\u5b9a SSE \u5b9e\u65f6\u63a8\u6d41\uff09 - \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\/59306.html","og_locale":"zh_CN","og_type":"article","og_title":"\u3010SSE\u5b9e\u6218\u3011\uff1a\u62d2\u7edd\u8f6e\u8be2\uff01\u4e00\u5957\u4ee3\u7801\u5403\u900f SSE!\uff08\u7528\u300cfetchEventSource\u300d\u4e00\u628a\u68ad\u641e\u5b9a SSE \u5b9e\u65f6\u63a8\u6d41\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb225\u6b21\uff0c\u70b9\u8d5e6\u6b21\uff0c\u6536\u85cf4\u6b21\u3002\u672c\u6587\u63a2\u8ba8\u4e86\u5982\u4f55\u4f18\u5316\u524d\u7aef\u5b9e\u65f6\u6570\u636e\u66f4\u65b0\u65b9\u6848\uff0c\u5c06\u4f20\u7edf\u7684setInterval\u8f6e\u8be2\u6539\u4e3aSSE\uff08Server-Sent Events\uff09\u6280\u672f\u3002\u901a\u8fc7SSE\u6280\u672f\uff0c\u5b9e\u73b0\u4e86\u66f4\u9ad8\u6548\u7684\u6570\u636e\u5b9e\u65f6\u66f4\u65b0\uff0c\u540c\u65f6\u964d\u4f4e\u4e86\u670d\u52a1\u5668\u8d1f\u8f7d\u548c\u524d\u7aef\u6027\u80fd\u6d88\u8017\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/59306.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-01-13T08:34:28+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260113083426-69660392aa0ef.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/59306.html","url":"https:\/\/www.wsisp.com\/helps\/59306.html","name":"\u3010SSE\u5b9e\u6218\u3011\uff1a\u62d2\u7edd\u8f6e\u8be2\uff01\u4e00\u5957\u4ee3\u7801\u5403\u900f SSE!\uff08\u7528\u300cfetchEventSource\u300d\u4e00\u628a\u68ad\u641e\u5b9a SSE \u5b9e\u65f6\u63a8\u6d41\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-01-13T08:34:28+00:00","dateModified":"2026-01-13T08:34:28+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/59306.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/59306.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/59306.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u3010SSE\u5b9e\u6218\u3011\uff1a\u62d2\u7edd\u8f6e\u8be2\uff01\u4e00\u5957\u4ee3\u7801\u5403\u900f SSE!\uff08\u7528\u300cfetchEventSource\u300d\u4e00\u628a\u68ad\u641e\u5b9a SSE \u5b9e\u65f6\u63a8\u6d41\uff09"}]},{"@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\/59306","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=59306"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/59306\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/59302"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=59306"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=59306"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=59306"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=59306"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}