{"id":4353,"date":"2022-07-02T21:55:21","date_gmt":"2022-07-02T13:55:21","guid":{"rendered":"https:\/\/xinchewhd.com.cn\/index.php\/spring-boot\/spring-boot%e6%95%b4%e5%90%88websocket%e5%ae%9e%e7%8e%b0%e5%ae%9e%e6%97%b6%e6%b6%88%e6%81%af%e6%8e%a8%e9%80%81\/"},"modified":"2022-07-02T21:55:21","modified_gmt":"2022-07-02T13:55:21","slug":"spring-boot%e6%95%b4%e5%90%88websocket%e5%ae%9e%e7%8e%b0%e5%ae%9e%e6%97%b6%e6%b6%88%e6%81%af%e6%8e%a8%e9%80%81","status":"publish","type":"post","link":"https:\/\/xinchewhd.com.cn\/index.php\/spring-boot\/spring-boot%e6%95%b4%e5%90%88websocket%e5%ae%9e%e7%8e%b0%e5%ae%9e%e6%97%b6%e6%b6%88%e6%81%af%e6%8e%a8%e9%80%81\/","title":{"rendered":"Spring Boot\u6574\u5408WebSocket\u5b9e\u73b0\u5b9e\u65f6\u6d88\u606f\u63a8\u9001"},"content":{"rendered":"<div class='wxsyncmain'>\n<h1 cid=\"n0\" mdtype=\"heading\" style=\"margin: 1rem 0px;padding: 0px 0px 0.3em;outline: 0px;font-weight: bold;font-size: 16px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;color: rgb(34, 34, 34);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: 0.544px;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;background-color: rgb(255, 255, 255);line-height: 1.2;cursor: text;border-bottom: 1px solid rgb(238, 238, 238);width: inherit;font-family: &quot;Open Sans&quot;, &quot;Clear Sans&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;text-align: start;white-space: pre-wrap;visibility: visible;\"><span style=\"margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(178, 178, 178);visibility: visible;\">\u5982\u679c\u6559\u7a0b\u4e2d\u4ee3\u7801\u4e0d\u4fbf\u4e8e\u9605\u8bfb\uff0c\u8bf7\u4f7f\u7528\u7535\u8111\u67e5\u770b\u6216\u70b9\u51fb\u9605\u8bfb\u539f\u6587\u3002<\/span><\/h1>\n<p><span style=\"margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(178, 178, 178);visibility: visible;\"><\/span><\/p>\n<h1 cid=\"n2\" mdtype=\"heading\" style=\"box-sizing: border-box;break-after: avoid-page;break-inside: avoid;orphans: 2;font-size: 2.25em;margin-top: 1rem;margin-bottom: 1rem;font-weight: bold;line-height: 1.2;cursor: text;padding-bottom: 0.3em;border-bottom: 1px solid rgb(238, 238, 238);white-space: pre-wrap;color: rgb(51, 51, 51);font-family: &quot;Open Sans&quot;, &quot;Clear Sans&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span md-inline=\"plain\" style=\"box-sizing: border-box;\">0. \u5f00\u53d1\u73af\u5883<\/span><\/h1>\n<ul class=\"list-paddingleft-1\" cid=\"n3\" mdtype=\"list\" data-mark=\"-\" style=\"box-sizing: border-box;margin: 0.8em 0px;padding-left: 30px;color: rgb(51, 51, 51);font-family: &quot;Open Sans&quot;, &quot;Clear Sans&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\">\n<li style=\"box-sizing: border-box;margin: 0px;\">\n<p cid=\"n7\" mdtype=\"paragraph\" style=\"box-sizing: border-box;orphans: 4;margin: 0px 0px 0.5rem;white-space: pre-wrap;\"><span md-inline=\"plain\" style=\"box-sizing: border-box;\">JDK\uff1a1.8<\/span><\/p>\n<\/li>\n<li style=\"box-sizing: border-box;margin: 0px;\">\n<p cid=\"n9\" mdtype=\"paragraph\" style=\"box-sizing: border-box;orphans: 4;margin: 0px 0px 0.5rem;white-space: pre-wrap;\"><span md-inline=\"plain\" style=\"box-sizing: border-box;\">Spring Boot\uff1a2.1.1.RELEASE<\/span><\/p>\n<\/li>\n<\/ul>\n<h1 cid=\"n14\" mdtype=\"heading\" style=\"box-sizing: border-box;break-after: avoid-page;break-inside: avoid;orphans: 2;font-size: 2.25em;margin-top: 1rem;margin-bottom: 1rem;font-weight: bold;line-height: 1.2;cursor: text;padding-bottom: 0.3em;border-bottom: 1px solid rgb(238, 238, 238);white-space: pre-wrap;color: rgb(51, 51, 51);font-family: &quot;Open Sans&quot;, &quot;Clear Sans&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span md-inline=\"plain\" style=\"box-sizing: border-box;\">1. \u5f15\u5165\u4f9d\u8d56<\/span><\/h1>\n<pre spellcheck=\"false\" lang=\"xml\" cid=\"n15\" mdtype=\"fences\" style=\"box-sizing: border-box;overflow: visible;font-family: var(--monospace);font-size: 0.9em;display: block;break-inside: avoid;text-align: left;white-space: normal;background-image: inherit;background-position: inherit;background-size: inherit;background-repeat: inherit;background-attachment: inherit;background-origin: inherit;background-clip: inherit;background-color: rgb(248, 248, 248);border-width: 1px;border-style: solid;border-color: rgb(231, 234, 237);border-radius: 3px;padding: 8px 4px 6px 0px;margin-bottom: 15px;margin-top: 15px;width: inherit;color: rgb(51, 51, 51);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&lt;<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">dependency<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&gt;<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">      <span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&lt;<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">groupId<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&gt;<\/span>org.springframework.boot<span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&lt;\/<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">groupId<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&gt;<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">      <span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&lt;<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">artifactId<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&gt;<\/span>spring-boot-starter-websocket<span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&lt;\/<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">artifactId<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&gt;<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&lt;\/<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">dependency<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&gt;<\/span><\/span><\/pre>\n<h1 cid=\"n16\" mdtype=\"heading\" style=\"box-sizing: border-box;break-after: avoid-page;break-inside: avoid;orphans: 2;font-size: 2.25em;margin-top: 1rem;margin-bottom: 1rem;font-weight: bold;line-height: 1.2;cursor: text;padding-bottom: 0.3em;border-bottom: 1px solid rgb(238, 238, 238);white-space: pre-wrap;color: rgb(51, 51, 51);font-family: &quot;Open Sans&quot;, &quot;Clear Sans&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span md-inline=\"plain\" style=\"box-sizing: border-box;\">2. \u65b0\u5efaWebSocket\u914d\u7f6e\u7c7b<\/span><\/h1>\n<pre spellcheck=\"false\" lang=\"java\" cid=\"n17\" mdtype=\"fences\" style=\"box-sizing: border-box;overflow: visible;font-family: var(--monospace);font-size: 0.9em;display: block;break-inside: avoid;text-align: left;white-space: normal;background-image: inherit;background-position: inherit;background-size: inherit;background-repeat: inherit;background-attachment: inherit;background-origin: inherit;background-clip: inherit;background-color: rgb(248, 248, 248);border-width: 1px;border-style: solid;border-color: rgb(231, 234, 237);border-radius: 3px;padding: 8px 4px 6px 0px;margin-bottom: 15px;margin-top: 15px;width: inherit;color: rgb(51, 51, 51);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">org<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">springframework<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">context<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">annotation<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Bean<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">org<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">springframework<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">context<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">annotation<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Configuration<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">org<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">springframework<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">web<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">socket<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">server<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">standard<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">ServerEndpointExporter<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(85, 85, 85);\">@Configuration<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">public<\/span> <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">class<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 255);\">WebSocketConfig<\/span> {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">\/**<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   <span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">* ServerEndpointExporter\u6ce8\u5165<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   <span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">* \u8be5Bean\u4f1a\u81ea\u52a8\u6ce8\u518c\u4f7f\u7528@ServerEndpoint\u6ce8\u89e3\u7533\u660e\u7684WebSocket endpoint<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   <span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">*<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   <span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">* @return<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   <span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">*\/<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(85, 85, 85);\">@Bean<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">public<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">ServerEndpointExporter<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">serverEndpointExporter<\/span>() {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">return<\/span> <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">new<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">ServerEndpointExporter<\/span>();<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">}<\/span><\/pre>\n<h1 cid=\"n18\" mdtype=\"heading\" style=\"box-sizing: border-box;break-after: avoid-page;break-inside: avoid;orphans: 2;font-size: 2.25em;margin-top: 1rem;margin-bottom: 1rem;font-weight: bold;line-height: 1.2;cursor: text;padding-bottom: 0.3em;border-bottom: 1px solid rgb(238, 238, 238);white-space: pre-wrap;color: rgb(51, 51, 51);font-family: &quot;Open Sans&quot;, &quot;Clear Sans&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span md-inline=\"plain\" style=\"box-sizing: border-box;\">3. \u65b0\u5efaWebSocket\u670d\u52a1\u7c7b<\/span><\/h1>\n<pre spellcheck=\"false\" lang=\"java\" cid=\"n19\" mdtype=\"fences\" style=\"box-sizing: border-box;overflow: visible;font-family: var(--monospace);font-size: 0.9em;display: block;break-inside: avoid;text-align: left;white-space: normal;background-image: inherit;background-position: inherit;background-size: inherit;background-repeat: inherit;background-attachment: inherit;background-origin: inherit;background-clip: inherit;background-color: rgb(248, 248, 248);border-width: 1px;border-style: solid;border-color: rgb(231, 234, 237);border-radius: 3px;padding: 8px 4px 6px 0px;margin-bottom: 15px;margin-top: 15px;width: inherit;color: rgb(51, 51, 51);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">package<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 255);\">cn<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">wbnull<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">springbootdemo<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">service<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">org<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">slf4j<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Logger<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">org<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">slf4j<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">LoggerFactory<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">org<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">springframework<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">stereotype<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Component<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">javax<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">websocket<\/span>.<span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">*<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">javax<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">websocket<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">server<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">PathParam<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">javax<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">websocket<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">server<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">ServerEndpoint<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">java<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">io<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">IOException<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">java<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">util<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Map<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">java<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">util<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">concurrent<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">ConcurrentHashMap<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(85, 85, 85);\">@Component<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(85, 85, 85);\">@ServerEndpoint<\/span>(<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"\/websocket\/{terminalId}\"<\/span>)<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">public<\/span> <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">class<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 255);\">WebSocketService<\/span> {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">private<\/span> <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">final<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Logger<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">logger<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">=<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">LoggerFactory<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">getLogger<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">WebSocketService<\/span>.<span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">class<\/span>);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">\/**<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   <span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">* \u4fdd\u5b58\u8fde\u63a5\u4fe1\u606f<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   <span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">*\/<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">private<\/span> <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">static<\/span> <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">final<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Map<\/span><span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">&lt;<\/span><span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">String<\/span>, <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Session<\/span><span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">&gt;<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">CLIENTS<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">=<\/span> <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">new<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">ConcurrentHashMap<\/span><span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">&lt;&gt;<\/span>();<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(85, 85, 85);\">@OnOpen<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">public<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">void<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">onOpen<\/span>(<span style=\"box-sizing: border-box;color: rgb(85, 85, 85);\">@PathParam<\/span>(<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"terminalId\"<\/span>) <span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">String<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">terminalId<\/span>, <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Session<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>) <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">throws<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Exception<\/span> {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">logger<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">info<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">getRequestURI<\/span>().<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">getPath<\/span>() <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">+<\/span> <span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"\uff0c\u6253\u5f00\u8fde\u63a5\u5f00\u59cb\uff1a\"<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">+<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">getId<\/span>());<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">\/\/\u5f53\u524d\u8fde\u63a5\u5df2\u5b58\u5728\uff0c\u5173\u95ed<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">if<\/span> (<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">CLIENTS<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">containsKey<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">terminalId<\/span>)) {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">      <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">onClose<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">CLIENTS<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">get<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">terminalId<\/span>));<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">     }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">CLIENTS<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">put<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">terminalId<\/span>, <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">logger<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">info<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">getRequestURI<\/span>().<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">getPath<\/span>() <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">+<\/span> <span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"\uff0c\u6253\u5f00\u8fde\u63a5\u5b8c\u6210\uff1a\"<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">+<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">getId<\/span>());<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(85, 85, 85);\">@OnClose<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">public<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">void<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">onClose<\/span>(<span style=\"box-sizing: border-box;color: rgb(85, 85, 85);\">@PathParam<\/span>(<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"terminalId\"<\/span>) <span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">String<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">terminalId<\/span>, <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Session<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>) <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">throws<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Exception<\/span> {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">logger<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">info<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">getRequestURI<\/span>().<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">getPath<\/span>() <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">+<\/span> <span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"\uff0c\u5173\u95ed\u8fde\u63a5\u5f00\u59cb\uff1a\"<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">+<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">getId<\/span>());<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">CLIENTS<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">remove<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">terminalId<\/span>);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">logger<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">info<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">getRequestURI<\/span>().<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">getPath<\/span>() <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">+<\/span> <span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"\uff0c\u5173\u95ed\u8fde\u63a5\u5b8c\u6210\uff1a\"<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">+<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">getId<\/span>());<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(85, 85, 85);\">@OnMessage<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">public<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">void<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">onMessage<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">String<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">message<\/span>, <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Session<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>) {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">logger<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">info<\/span>(<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"\u524d\u53f0\u53d1\u9001\u6d88\u606f\uff1a\"<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">+<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">message<\/span>);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(85, 85, 85);\">@OnError<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">public<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">void<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">onError<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Session<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>, <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Throwable<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">error<\/span>) {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">logger<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">error<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">error<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">toString<\/span>());<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">public<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">void<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">onClose<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Session<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>) {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">\/\/\u5224\u65ad\u5f53\u524d\u8fde\u63a5\u662f\u5426\u5728\u7ebf<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">\/\/     if (!session.isOpen()) {<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">\/\/       return;<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">\/\/     }<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">try<\/span> {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">      <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">close<\/span>();<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">     } <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">catch<\/span> (<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">IOException<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">e<\/span>) {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">      <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">logger<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">error<\/span>(<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"\u91d1\u6597\u4e91\u5173\u95ed\u8fde\u63a5\u5f02\u5e38\uff1a\"<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">+<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">e<\/span>);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">     }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">public<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">void<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">sendMessage<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">String<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">message<\/span>, <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Session<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>) {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">try<\/span> {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">      <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">getAsyncRemote<\/span>().<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">sendText<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">message<\/span>);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">      <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">logger<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">info<\/span>(<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"\u63a8\u9001\u6210\u529f\uff1a\"<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">+<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">message<\/span>);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">     } <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">catch<\/span> (<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Exception<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">e<\/span>) {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">      <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">logger<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">error<\/span>(<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"\u63a8\u9001\u5f02\u5e38\uff1a\"<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">+<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">e<\/span>);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">     }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">public<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">boolean<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">sendMessage<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">String<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">terminalId<\/span>, <span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">String<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">message<\/span>) {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">try<\/span> {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">      <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Session<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">=<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">CLIENTS<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">get<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">terminalId<\/span>);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">      <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">getAsyncRemote<\/span>().<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">sendText<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">message<\/span>);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">      <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">logger<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">info<\/span>(<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"\u63a8\u9001\u6210\u529f\uff1a\"<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">+<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">message<\/span>);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">      <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">return<\/span> <span style=\"box-sizing: border-box;color: rgb(34, 17, 153);\">true<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">     } <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">catch<\/span> (<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Exception<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">e<\/span>) {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">      <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">logger<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">error<\/span>(<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"\u63a8\u9001\u5f02\u5e38\uff1a\"<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">+<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">e<\/span>);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">      <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">return<\/span> <span style=\"box-sizing: border-box;color: rgb(34, 17, 153);\">false<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">     }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">}<\/span><\/pre>\n<h1 cid=\"n20\" mdtype=\"heading\" style=\"box-sizing: border-box;break-after: avoid-page;break-inside: avoid;orphans: 2;font-size: 2.25em;margin-top: 1rem;margin-bottom: 1rem;font-weight: bold;line-height: 1.2;cursor: text;padding-bottom: 0.3em;border-bottom: 1px solid rgb(238, 238, 238);white-space: pre-wrap;color: rgb(51, 51, 51);font-family: &quot;Open Sans&quot;, &quot;Clear Sans&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span md-inline=\"plain\" style=\"box-sizing: border-box;\">4. \u65b0\u5efaWeb\u7aef\u8fde\u63a5\u9875\u9762<\/span><\/h1>\n<pre spellcheck=\"false\" lang=\"html\" cid=\"n21\" mdtype=\"fences\" style=\"box-sizing: border-box;overflow: visible;font-family: var(--monospace);font-size: 0.9em;display: block;break-inside: avoid;text-align: left;white-space: normal;background-image: inherit;background-position: inherit;background-size: inherit;background-repeat: inherit;background-attachment: inherit;background-origin: inherit;background-clip: inherit;background-color: rgb(248, 248, 248);border-width: 1px;border-style: solid;border-color: rgb(231, 234, 237);border-radius: 3px;padding: 8px 4px 6px 0px;margin-bottom: 15px;margin-top: 15px;width: inherit;color: rgb(51, 51, 51);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(85, 85, 85);\">&lt;!DOCTYPE html&gt;<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&lt;<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">html<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 204);\">lang<\/span>=<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"en\"<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&gt;<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&lt;<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">head<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&gt;<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&lt;<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">meta<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 204);\">charset<\/span>=<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"UTF-8\"<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&gt;<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&lt;<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">title<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&gt;<\/span>WebSocket Test<span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&lt;\/<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">title<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&gt;<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&lt;\/<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">head<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&gt;<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&lt;<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">body<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&gt;<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&lt;<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">label<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 204);\">for<\/span>=<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"text\"<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&gt;&lt;\/<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">label<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&gt;&lt;<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">input<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 204);\">id<\/span>=<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"text\"<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 204);\">type<\/span>=<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"text\"<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">\/&gt;<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&lt;<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">button<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 204);\">onclick<\/span>=<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"sendMessage()\"<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&gt;<\/span>\u53d1\u9001\u6d88\u606f<span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&lt;\/<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">button<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&gt;<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&lt;<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">button<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 204);\">onclick<\/span>=<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"closeWebSocket()\"<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&gt;<\/span>\u5173\u95ed\u8fde\u63a5<span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&lt;\/<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">button<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&gt;<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&lt;<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">div<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 204);\">id<\/span>=<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"message\"<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&gt;&lt;\/<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">div<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&gt;<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&lt;\/<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">body<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&gt;<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&lt;<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">script<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 204);\">type<\/span>=<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"text\/javascript\"<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&gt;<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">let<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 255);\">websocket<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">=<\/span> <span style=\"box-sizing: border-box;color: rgb(34, 17, 153);\">null<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">\/\/\u5224\u65ad\u5f53\u524d\u6d4f\u89c8\u5668\u662f\u5426\u652f\u6301WebSocket<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">if<\/span> (<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">'WebSocket'<\/span> <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">in<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">window<\/span>) {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">websocket<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">=<\/span> <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">new<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">WebSocket<\/span>(<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"ws:\/\/localhost:8090\/websocket\/123456\"<\/span>);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   } <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">else<\/span> {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">alert<\/span>(<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">'Not support websocket'<\/span>);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">\/\/\u8fde\u63a5\u53d1\u751f\u9519\u8bef\u7684\u56de\u8c03\u65b9\u6cd5<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">websocket<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">onerror<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">=<\/span> <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">function<\/span> () {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">showMessage<\/span>(<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"\u6253\u5f00\u8fde\u63a5\u5931\u8d25\"<\/span>);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   };<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">\/\/\u8fde\u63a5\u6210\u529f\u5efa\u7acb\u7684\u56de\u8c03\u65b9\u6cd5<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">websocket<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">onopen<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">=<\/span> <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">function<\/span> (<span style=\"box-sizing: border-box;color: rgb(0, 0, 255);\">event<\/span>) {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">showMessage<\/span>(<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"\u6253\u5f00\u8fde\u63a5\u6210\u529f\"<\/span>);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">\/\/\u63a5\u6536\u5230\u6d88\u606f\u7684\u56de\u8c03\u65b9\u6cd5<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">websocket<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">onmessage<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">=<\/span> <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">function<\/span> (<span style=\"box-sizing: border-box;color: rgb(0, 0, 255);\">event<\/span>) {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">showMessage<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 85, 170);\">event<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">data<\/span>);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">\/\/\u8fde\u63a5\u5173\u95ed\u7684\u56de\u8c03\u65b9\u6cd5<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">websocket<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">onclose<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">=<\/span> <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">function<\/span> () {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">showMessage<\/span>(<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"\u5173\u95ed\u8fde\u63a5\u6210\u529f\"<\/span>);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">\/\/\u76d1\u542c\u7a97\u53e3\u5173\u95ed\u4e8b\u4ef6\uff0c\u5f53\u7a97\u53e3\u5173\u95ed\u65f6\uff0c\u4e3b\u52a8\u5173\u95edWebSocket\u8fde\u63a5<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">window<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">onbeforeunload<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">=<\/span> <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">function<\/span> () {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">websocket<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">close<\/span>();<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">function<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 255);\">showMessage<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 255);\">message<\/span>) {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">document<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">getElementById<\/span>(<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">'message'<\/span>).<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">innerHTML<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">+=<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 85, 170);\">message<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">+<\/span> <span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">'&lt;br\/&gt;'<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">function<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 255);\">closeWebSocket<\/span>() {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">websocket<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">close<\/span>();<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">\/\/\u53d1\u9001\u6d88\u606f<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">function<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 255);\">sendMessage<\/span>() {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">const<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 255);\">message<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">=<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">document<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">getElementById<\/span>(<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">'text'<\/span>).<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">value<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">websocket<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">send<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 85, 170);\">message<\/span>);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&lt;\/<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">script<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&gt;<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&lt;\/<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">html<\/span><span style=\"box-sizing: border-box;color: rgb(17, 119, 0);\">&gt;<\/span><\/span><\/pre>\n<h1 cid=\"n70\" mdtype=\"heading\" style=\"box-sizing: border-box;break-after: avoid-page;break-inside: avoid;orphans: 2;font-size: 2.25em;margin-top: 1rem;margin-bottom: 1rem;font-weight: bold;line-height: 1.2;cursor: text;padding-bottom: 0.3em;border-bottom: 1px solid rgb(238, 238, 238);white-space: pre-wrap;color: rgb(51, 51, 51);font-family: &quot;Open Sans&quot;, &quot;Clear Sans&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span md-inline=\"plain\" style=\"box-sizing: border-box;\">5. \u8bbe\u7f6e\u540e\u7aef\u6d88\u606f\u63a8\u9001<\/span><\/h1>\n<p cid=\"n74\" mdtype=\"paragraph\" style=\"box-sizing: border-box;orphans: 4;margin: 0.8em 0px;white-space: pre-wrap;color: rgb(51, 51, 51);font-family: &quot;Open Sans&quot;, &quot;Clear Sans&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span md-inline=\"plain\" style=\"box-sizing: border-box;\">\u4e3a\u4fbf\u4e8e\u6d4b\u8bd5\uff0c\u76f4\u63a5\u4fee\u6539WebSocketService\uff0c\u5f53\u6536\u5230\u524d\u53f0\u6d88\u606f\u65f6\uff0c\u76f4\u63a5\u7ed9\u524d\u53f0\u53d1\u9001\u6d88\u606f<\/span><\/p>\n<pre spellcheck=\"false\" lang=\"\" cid=\"n71\" mdtype=\"fences\" style=\"box-sizing: border-box;overflow: visible;font-family: var(--monospace);font-size: 0.9em;display: block;break-inside: avoid;text-align: left;white-space: normal;background-image: inherit;background-position: inherit;background-size: inherit;background-repeat: inherit;background-attachment: inherit;background-origin: inherit;background-clip: inherit;background-color: rgb(248, 248, 248);border-width: 1px;border-style: solid;border-color: rgb(231, 234, 237);border-radius: 3px;padding: 8px 4px 6px 0px;margin-bottom: 15px;margin-top: 15px;width: inherit;color: rgb(51, 51, 51);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   @OnMessage<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   public void onMessage(String message, Session session) {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">     logger.info(\"\u524d\u53f0\u53d1\u9001\u6d88\u606f\uff1a\" + message);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">     sendMessage(\"\u6536\u5230\u6d88\u606f\uff1a\" + message, session);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   }<\/span><\/pre>\n<h1 cid=\"n59\" mdtype=\"heading\" style=\"box-sizing: border-box;break-after: avoid-page;break-inside: avoid;orphans: 2;font-size: 2.25em;margin-top: 1rem;margin-bottom: 1rem;font-weight: bold;line-height: 1.2;cursor: text;padding-bottom: 0.3em;border-bottom: 1px solid rgb(238, 238, 238);white-space: pre-wrap;color: rgb(51, 51, 51);font-family: &quot;Open Sans&quot;, &quot;Clear Sans&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span md-inline=\"plain\" style=\"box-sizing: border-box;\">6. \u6d4b\u8bd5<\/span><\/h1>\n<p cid=\"n39\" mdtype=\"paragraph\" style=\"box-sizing: border-box;orphans: 4;margin: 0.8em 0px;white-space: pre-wrap;color: rgb(51, 51, 51);font-family: &quot;Open Sans&quot;, &quot;Clear Sans&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span md-inline=\"plain\" style=\"box-sizing: border-box;\">\u6d4f\u89c8\u5668\u8bbf\u95ee<\/span><span md-inline=\"url\" spellcheck=\"false\" style=\"box-sizing: border-box;word-break: break-all;\">http:\/\/127.0.0.1:8090\/<\/span><span md-inline=\"plain\" style=\"box-sizing: border-box;\">\uff0c\u9875\u9762\u663e\u793a\u5982\u4e0b\uff1a<\/span><\/p>\n<p style=\"text-align: center;margin-bottom: 0em;\"><img decoding=\"async\" class=\"rich_pages wxw-img js_insertlocalimg lazyload\" data-ratio=\"0.2490272373540856\" data-s=\"300,640\"  data-type=\"png\" data-w=\"514\" style=\"\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524153112733.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img js_insertlocalimg\" data-ratio=\"0.2490272373540856\" data-s=\"300,640\"  data-type=\"png\" data-w=\"514\" style=\"\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524153112733.png\"  \/><\/noscript><\/p>\n<p cid=\"n41\" mdtype=\"paragraph\" style=\"box-sizing: border-box;orphans: 4;margin: 0.8em 0px;white-space: pre-wrap;color: rgb(51, 51, 51);font-family: &quot;Open Sans&quot;, &quot;Clear Sans&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span md-inline=\"plain\" style=\"box-sizing: border-box;\">\u540e\u53f0\u65e5\u5fd7\u5982\u4e0b\uff1a<\/span><\/p>\n<pre mdtype=\"fences\" cid=\"n45\" lang=\"\" spellcheck=\"false\" style=\"box-sizing: border-box;overflow: visible;font-family: var(--monospace);font-size: 0.9em;display: block;break-inside: avoid;text-align: left;white-space: normal;background-image: inherit;background-position: inherit;background-size: inherit;background-repeat: inherit;background-attachment: inherit;background-origin: inherit;background-clip: inherit;background-color: rgb(248, 248, 248);border-width: 1px;border-style: solid;border-color: rgb(231, 234, 237);border-radius: 3px;padding: 8px 4px 6px 0px;margin-bottom: 15px;margin-top: 15px;width: inherit;color: rgb(51, 51, 51);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">2022-07-02 21:03:22.753  INFO 9168 --- [nio-8090-exec-2] c.w.s.service.WebSocketService      : \/websocket\/123456\uff0c\u6253\u5f00\u8fde\u63a5\u5f00\u59cb\uff1a0<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">2022-07-02 21:03:22.753  INFO 9168 --- [nio-8090-exec-2] c.w.s.service.WebSocketService      : \/websocket\/123456\uff0c\u6253\u5f00\u8fde\u63a5\u5b8c\u6210\uff1a0<\/span><\/pre>\n<p cid=\"n47\" mdtype=\"paragraph\" style=\"box-sizing: border-box;orphans: 4;margin: 0.8em 0px;white-space: pre-wrap;color: rgb(51, 51, 51);font-family: &quot;Open Sans&quot;, &quot;Clear Sans&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span md-inline=\"plain\" style=\"box-sizing: border-box;\">\u5f53\u6211\u4eec\u6d4f\u89c8\u5668\u6253\u5f00\u7b2c\u4e8c\u4e2a\u9875\u9762\uff0c\u7b2c\u4e00\u4e2a\u9875\u9762\u4f1a\u663e\u793a\u65ad\u5f00\u8fde\u63a5<\/span><\/p>\n<p style=\"text-align: center;margin-bottom: 0em;\"><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-galleryid=\"\" data-ratio=\"0.27194860813704497\" data-s=\"300,640\"  data-type=\"png\" data-w=\"467\" style=\"\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524153115476.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-galleryid=\"\" data-ratio=\"0.27194860813704497\" data-s=\"300,640\"  data-type=\"png\" data-w=\"467\" style=\"\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524153115476.png\"  \/><\/noscript><\/p>\n<p cid=\"n53\" mdtype=\"paragraph\" style=\"box-sizing: border-box;orphans: 4;margin: 0.8em 0px;white-space: pre-wrap;color: rgb(51, 51, 51);font-family: &quot;Open Sans&quot;, &quot;Clear Sans&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span md-inline=\"plain\" style=\"box-sizing: border-box;\">\u540e\u53f0\u65e5\u5fd7\u5982\u4e0b\uff1a<\/span><\/p>\n<pre mdtype=\"fences\" cid=\"n55\" lang=\"\" spellcheck=\"false\" style=\"box-sizing: border-box;overflow: visible;font-family: var(--monospace);font-size: 0.9em;display: block;break-inside: avoid;text-align: left;white-space: normal;background-image: inherit;background-position: inherit;background-size: inherit;background-repeat: inherit;background-attachment: inherit;background-origin: inherit;background-clip: inherit;background-color: rgb(248, 248, 248);border-width: 1px;border-style: solid;border-color: rgb(231, 234, 237);border-radius: 3px;padding: 8px 4px 6px 0px;margin-bottom: 15px;margin-top: 15px;width: inherit;color: rgb(51, 51, 51);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">2022-07-02 21:04:01.936  INFO 9168 --- [nio-8090-exec-4] c.w.s.service.WebSocketService      : \/websocket\/123456\uff0c\u6253\u5f00\u8fde\u63a5\u5f00\u59cb\uff1a1<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">2022-07-02 21:04:01.938  INFO 9168 --- [nio-8090-exec-4] c.w.s.service.WebSocketService      : \/websocket\/123456\uff0c\u5173\u95ed\u8fde\u63a5\u5f00\u59cb\uff1a0<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">2022-07-02 21:04:01.938  INFO 9168 --- [nio-8090-exec-4] c.w.s.service.WebSocketService      : \/websocket\/123456\uff0c\u5173\u95ed\u8fde\u63a5\u5b8c\u6210\uff1a0<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">2022-07-02 21:04:01.938  INFO 9168 --- [nio-8090-exec-4] c.w.s.service.WebSocketService      : \/websocket\/123456\uff0c\u6253\u5f00\u8fde\u63a5\u5b8c\u6210\uff1a1<\/span><\/pre>\n<p cid=\"n57\" mdtype=\"paragraph\" style=\"box-sizing: border-box;orphans: 4;margin: 0.8em 0px;white-space: pre-wrap;color: rgb(51, 51, 51);font-family: &quot;Open Sans&quot;, &quot;Clear Sans&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span md-inline=\"plain\" style=\"box-sizing: border-box;\">\u524d\u53f0\u9875\u9762\u5f55\u5165\u6d88\u606f\u5e76\u53d1\u9001\uff0c\u540e\u53f0\u53ef\u6b63\u5e38\u6536\u5230\u6d88\u606f<\/span><\/p>\n<pre mdtype=\"fences\" cid=\"n60\" lang=\"\" spellcheck=\"false\" style=\"box-sizing: border-box;overflow: visible;font-family: var(--monospace);font-size: 0.9em;display: block;break-inside: avoid;text-align: left;white-space: normal;background-image: inherit;background-position: inherit;background-size: inherit;background-repeat: inherit;background-attachment: inherit;background-origin: inherit;background-clip: inherit;background-color: rgb(248, 248, 248);border-width: 1px;border-style: solid;border-color: rgb(231, 234, 237);border-radius: 3px;padding: 8px 4px 6px 0px;margin-bottom: 15px;margin-top: 15px;width: inherit;color: rgb(51, 51, 51);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">2022-07-02 21:08:21.860  INFO 1772 --- [nio-8090-exec-3] c.w.s.service.WebSocketService      : \u524d\u53f0\u53d1\u9001\u6d88\u606f\uff1a\u6d4b\u8bd5\u6d88\u606f<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">2022-07-02 21:08:21.863  INFO 1772 --- [nio-8090-exec-3] c.w.s.service.WebSocketService      : \u63a8\u9001\u6210\u529f\uff1a\u6536\u5230\u6d88\u606f\uff1a\u6d4b\u8bd5\u6d88\u606f<\/span><\/pre>\n<p cid=\"n62\" mdtype=\"paragraph\" style=\"box-sizing: border-box;orphans: 4;margin: 0.8em 0px;white-space: pre-wrap;color: rgb(51, 51, 51);font-family: &quot;Open Sans&quot;, &quot;Clear Sans&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span md-inline=\"plain\" style=\"box-sizing: border-box;\">\u524d\u53f0\u9875\u9762\u663e\u793a\u6b63\u5e38<\/span><\/p>\n<p style=\"text-align: center;margin-bottom: 0em;\"><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-galleryid=\"\" data-ratio=\"0.25949367088607594\" data-s=\"300,640\"  data-type=\"png\" data-w=\"474\" style=\"\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524153118792.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-galleryid=\"\" data-ratio=\"0.25949367088607594\" data-s=\"300,640\"  data-type=\"png\" data-w=\"474\" style=\"\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524153118792.png\"  \/><\/noscript><\/p>\n<p cid=\"n78\" mdtype=\"paragraph\" style=\"box-sizing: border-box;orphans: 4;margin: 0.8em 0px;white-space: pre-wrap;color: rgb(51, 51, 51);font-family: &quot;Open Sans&quot;, &quot;Clear Sans&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span md-inline=\"plain\" style=\"box-sizing: border-box;\">\u70b9\u51fb\u5173\u95ed\u8fde\u63a5\uff0c\u53ef\u4ee5\u6b63\u5e38\u5173\u95ed<\/span><\/p>\n<h1 cid=\"n26\" mdtype=\"heading\" style=\"box-sizing: border-box;break-after: avoid-page;break-inside: avoid;orphans: 2;font-size: 2.25em;margin-top: 1rem;margin-bottom: 1rem;font-weight: bold;line-height: 1.2;cursor: text;padding-bottom: 0.3em;border-bottom: 1px solid rgb(238, 238, 238);white-space: pre-wrap;color: rgb(51, 51, 51);font-family: &quot;Open Sans&quot;, &quot;Clear Sans&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span md-inline=\"plain\" style=\"box-sizing: border-box;\">7. \u670d\u52a1\u4fdd\u6d3b<\/span><\/h1>\n<p cid=\"n27\" mdtype=\"paragraph\" style=\"box-sizing: border-box;orphans: 4;margin: 0.8em 0px;white-space: pre-wrap;color: rgb(51, 51, 51);font-family: &quot;Open Sans&quot;, &quot;Clear Sans&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span md-inline=\"plain\" style=\"box-sizing: border-box;\">\u5bf9\u4e8e\u5b9e\u65f6\u6d88\u606f\u63a8\u9001\u76f8\u5173\u670d\u52a1\uff0c\u90fd\u5b58\u5728\u4fdd\u6d3b\u95ee\u9898\u3002\u8fd9\u91cc\u6211\u4eec\u91c7\u7528\u5fc3\u8df3\u4fdd\u6d3b\u3002\u4fee\u6539WebSocketService\u7c7b<\/span><\/p>\n<pre spellcheck=\"false\" lang=\"java\" cid=\"n28\" mdtype=\"fences\" style=\"box-sizing: border-box;overflow: visible;font-family: var(--monospace);font-size: 0.9em;display: block;break-inside: avoid;text-align: left;white-space: normal;background-image: inherit;background-position: inherit;background-size: inherit;background-repeat: inherit;background-attachment: inherit;background-origin: inherit;background-clip: inherit;background-color: rgb(248, 248, 248);border-width: 1px;border-style: solid;border-color: rgb(231, 234, 237);border-radius: 3px;padding: 8px 4px 6px 0px;margin-bottom: 15px;margin-top: 15px;width: inherit;color: rgb(51, 51, 51);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">org<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">slf4j<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Logger<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">org<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">slf4j<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">LoggerFactory<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">org<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">springframework<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">stereotype<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Component<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">javax<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">websocket<\/span>.<span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">*<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">javax<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">websocket<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">server<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">PathParam<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">javax<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">websocket<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">server<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">ServerEndpoint<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">java<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">io<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">IOException<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">java<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">util<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">HashMap<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">java<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">util<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Map<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">java<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">util<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">concurrent<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">ConcurrentHashMap<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">java<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">util<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">concurrent<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">atomic<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">AtomicInteger<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(85, 85, 85);\">@Component<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(85, 85, 85);\">@ServerEndpoint<\/span>(<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"\/websocket\/{terminalId}\"<\/span>)<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">public<\/span> <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">class<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 255);\">WebSocketService<\/span> {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">private<\/span> <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">final<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Logger<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">logger<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">=<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">LoggerFactory<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">getLogger<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">WebSocketService<\/span>.<span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">class<\/span>);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">\/**<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   <span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">* \u4fdd\u5b58\u8fde\u63a5\u4fe1\u606f<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   <span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">*\/<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">private<\/span> <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">static<\/span> <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">final<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Map<\/span><span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">&lt;<\/span><span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">String<\/span>, <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Session<\/span><span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">&gt;<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">CLIENTS<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">=<\/span> <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">new<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">ConcurrentHashMap<\/span><span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">&lt;&gt;<\/span>();<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">private<\/span> <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">static<\/span> <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">final<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Map<\/span><span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">&lt;<\/span><span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">String<\/span>, <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">AtomicInteger<\/span><span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">&gt;<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">TERMINAL_IDS<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">=<\/span> <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">new<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">HashMap<\/span><span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">&lt;&gt;<\/span>();<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(85, 85, 85);\">@OnOpen<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">public<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">void<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">onOpen<\/span>(<span style=\"box-sizing: border-box;color: rgb(85, 85, 85);\">@PathParam<\/span>(<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"terminalId\"<\/span>) <span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">String<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">terminalId<\/span>, <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Session<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>) <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">throws<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Exception<\/span> {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">logger<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">info<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">getRequestURI<\/span>().<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">getPath<\/span>() <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">+<\/span> <span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"\uff0c\u6253\u5f00\u8fde\u63a5\u5f00\u59cb\uff1a\"<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">+<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">getId<\/span>());<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">\/\/\u5f53\u524d\u8fde\u63a5\u5df2\u5b58\u5728\uff0c\u5173\u95ed<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">if<\/span> (<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">CLIENTS<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">containsKey<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">terminalId<\/span>)) {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">      <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">onClose<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">CLIENTS<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">get<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">terminalId<\/span>));<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">     }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">TERMINAL_IDS<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">put<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">terminalId<\/span>, <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">new<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">AtomicInteger<\/span>(<span style=\"box-sizing: border-box;color: rgb(17, 102, 68);\">0<\/span>));<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">CLIENTS<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">put<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">terminalId<\/span>, <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">logger<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">info<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">getRequestURI<\/span>().<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">getPath<\/span>() <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">+<\/span> <span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"\uff0c\u6253\u5f00\u8fde\u63a5\u5b8c\u6210\uff1a\"<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">+<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">getId<\/span>());<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(85, 85, 85);\">@OnClose<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">public<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">void<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">onClose<\/span>(<span style=\"box-sizing: border-box;color: rgb(85, 85, 85);\">@PathParam<\/span>(<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"terminalId\"<\/span>) <span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">String<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">terminalId<\/span>, <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Session<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>) <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">throws<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Exception<\/span> {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">logger<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">info<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">getRequestURI<\/span>().<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">getPath<\/span>() <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">+<\/span> <span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"\uff0c\u5173\u95ed\u8fde\u63a5\u5f00\u59cb\uff1a\"<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">+<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">getId<\/span>());<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">CLIENTS<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">remove<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">terminalId<\/span>);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">TERMINAL_IDS<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">remove<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">terminalId<\/span>);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">logger<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">info<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">getRequestURI<\/span>().<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">getPath<\/span>() <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">+<\/span> <span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"\uff0c\u5173\u95ed\u8fde\u63a5\u5b8c\u6210\uff1a\"<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">+<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">getId<\/span>());<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(85, 85, 85);\">@OnMessage<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">public<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">void<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">onMessage<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">String<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">message<\/span>, <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Session<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>) {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">logger<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">info<\/span>(<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"\u524d\u53f0\u53d1\u9001\u6d88\u606f\uff1a\"<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">+<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">message<\/span>);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">if<\/span> (<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"\u5fc3\u8df3\"<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">equals<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">message<\/span>)) {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">      <span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">\/\/\u91cd\u7f6e\u5f53\u524d\u7ec8\u7aef\u5fc3\u8df3\u6b21\u6570<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">      <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">TERMINAL_IDS<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">get<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">message<\/span>).<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">set<\/span>(<span style=\"box-sizing: border-box;color: rgb(17, 102, 68);\">0<\/span>);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">      <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">return<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">     }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">sendMessage<\/span>(<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"\u6536\u5230\u6d88\u606f\uff1a\"<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">+<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">message<\/span>, <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(85, 85, 85);\">@OnError<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">public<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">void<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">onError<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Session<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>, <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Throwable<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">error<\/span>) {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">logger<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">error<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">error<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">toString<\/span>());<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">public<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">void<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">onClose<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Session<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>) {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">\/\/\u5224\u65ad\u5f53\u524d\u8fde\u63a5\u662f\u5426\u5728\u7ebf<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">\/\/     if (!session.isOpen()) {<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">\/\/       return;<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">\/\/     }<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">try<\/span> {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">      <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">close<\/span>();<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">     } <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">catch<\/span> (<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">IOException<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">e<\/span>) {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">      <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">logger<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">error<\/span>(<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"\u91d1\u6597\u4e91\u5173\u95ed\u8fde\u63a5\u5f02\u5e38\uff1a\"<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">+<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">e<\/span>);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">     }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">public<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">void<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">heartbeat<\/span>() {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">\/\/\u68c0\u67e5\u6240\u6709\u7ec8\u7aef\u5fc3\u8df3\u6b21\u6570<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">for<\/span> (<span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">String<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">key<\/span> : <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">TERMINAL_IDS<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">keySet<\/span>()) {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">      <span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">\/\/\u5fc3\u8df33\u6b21\u53ca\u4ee5\u4e0a\u7684\u4e3b\u52a8\u65ad\u5f00<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">      <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">if<\/span> ((<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">TERMINAL_IDS<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">get<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">key<\/span>).<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">intValue<\/span>() <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">&gt;=<\/span> <span style=\"box-sizing: border-box;color: rgb(17, 102, 68);\">3<\/span>)) {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">        <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">logger<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">info<\/span>(<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"\u5fc3\u8df3\u8d85\u65f6\uff0c\u5173\u95ed\u8fde\u63a5\uff1a\"<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">+<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">key<\/span>);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">        <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">onClose<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">CLIENTS<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">get<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">key<\/span>));<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">       }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">     }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">for<\/span> (<span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">String<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">key<\/span> : <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">CLIENTS<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">keySet<\/span>()) {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">      <span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">\/\/\u8bb0\u5f55\u5f53\u524d\u7ec8\u7aef\u5fc3\u8df3\u6b21\u6570<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">      <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">TERMINAL_IDS<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">get<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">key<\/span>).<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">incrementAndGet<\/span>();<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">      <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">sendMessage<\/span>(<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"\u5fc3\u8df3\"<\/span>, <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">CLIENTS<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">get<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">key<\/span>));<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">     }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">public<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">void<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">sendMessage<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">String<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">message<\/span>, <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Session<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>) {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">try<\/span> {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">      <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">getAsyncRemote<\/span>().<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">sendText<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">message<\/span>);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">      <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">logger<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">info<\/span>(<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"\u63a8\u9001\u6210\u529f\uff1a\"<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">+<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">message<\/span>);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">     } <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">catch<\/span> (<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Exception<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">e<\/span>) {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">      <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">logger<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">error<\/span>(<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"\u63a8\u9001\u5f02\u5e38\uff1a\"<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">+<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">e<\/span>);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">     }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">public<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">boolean<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">sendMessage<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">String<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">terminalId<\/span>, <span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">String<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">message<\/span>) {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">try<\/span> {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">      <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Session<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">=<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">CLIENTS<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">get<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">terminalId<\/span>);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">      <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">getAsyncRemote<\/span>().<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">sendText<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">message<\/span>);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">      <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">logger<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">info<\/span>(<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"\u63a8\u9001\u6210\u529f\uff1a\"<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">+<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">message<\/span>);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">      <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">return<\/span> <span style=\"box-sizing: border-box;color: rgb(34, 17, 153);\">true<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">     } <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">catch<\/span> (<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Exception<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">e<\/span>) {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">      <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">logger<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">error<\/span>(<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"\u63a8\u9001\u5f02\u5e38\uff1a\"<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">+<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">e<\/span>);<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">      <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">return<\/span> <span style=\"box-sizing: border-box;color: rgb(34, 17, 153);\">false<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">     }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">}<\/span><\/pre>\n<h1 cid=\"n29\" mdtype=\"heading\" style=\"box-sizing: border-box;break-after: avoid-page;break-inside: avoid;orphans: 2;font-size: 2.25em;margin-top: 1rem;margin-bottom: 1rem;font-weight: bold;line-height: 1.2;cursor: text;padding-bottom: 0.3em;border-bottom: 1px solid rgb(238, 238, 238);white-space: pre-wrap;color: rgb(51, 51, 51);font-family: &quot;Open Sans&quot;, &quot;Clear Sans&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span md-inline=\"plain\" style=\"box-sizing: border-box;\">8. \u65b0\u589e\u5b9a\u65f6\u4efb\u52a1<\/span><\/h1>\n<p cid=\"n30\" mdtype=\"paragraph\" style=\"box-sizing: border-box;orphans: 4;margin: 0.8em 0px;white-space: pre-wrap;color: rgb(51, 51, 51);font-family: &quot;Open Sans&quot;, &quot;Clear Sans&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span md-inline=\"plain\" style=\"box-sizing: border-box;\">\u65b0\u589e\u5b9a\u65f6\u4efb\u52a1\uff0c\u5b9a\u65f6\u7ed9\u8fde\u63a5\u5230WebSocket\u7684\u7ec8\u7aef\u53d1\u9001\u6d88\u606f\uff0c\u8d85\u8fc7\u6307\u5b9a\u6b21\u6570\u672a\u56de\u5e94\u7684\u7ec8\u7aef\u89c6\u4e3a\u79bb\u7ebf\uff0c\u4e3b\u52a8\u5173\u95ed\u8fde\u63a5\u3002<\/span><\/p>\n<pre spellcheck=\"false\" lang=\"java\" cid=\"n31\" mdtype=\"fences\" style=\"box-sizing: border-box;overflow: visible;font-family: var(--monospace);font-size: 0.9em;display: block;break-inside: avoid;text-align: left;white-space: normal;background-image: inherit;background-position: inherit;background-size: inherit;background-repeat: inherit;background-attachment: inherit;background-origin: inherit;background-clip: inherit;background-color: rgb(248, 248, 248);border-width: 1px;border-style: solid;border-color: rgb(231, 234, 237);border-radius: 3px;padding: 8px 4px 6px 0px;margin-bottom: 15px;margin-top: 15px;width: inherit;color: rgb(51, 51, 51);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">cn<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">wbnull<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">springbootdemo<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">service<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">WebSocketService<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">org<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">springframework<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">beans<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">factory<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">annotation<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Autowired<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">org<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">springframework<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">scheduling<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">annotation<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">EnableScheduling<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">org<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">springframework<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">scheduling<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">annotation<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Scheduled<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">org<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">springframework<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">stereotype<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Component<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(85, 85, 85);\">@EnableScheduling<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(85, 85, 85);\">@Component<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">public<\/span> <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">class<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 255);\">WebSocketScheduled<\/span> {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(85, 85, 85);\">@Autowired<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">private<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">WebSocketService<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">webSocketService<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(85, 85, 85);\">@Scheduled<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">cron<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">=<\/span> <span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"0\/15 * * * * ?\"<\/span>)<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">public<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">void<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">heartbeat<\/span>() {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">webSocketService<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">heartbeat<\/span>();<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">}<\/span><\/pre>\n<p cid=\"n32\" mdtype=\"paragraph\" style=\"box-sizing: border-box;orphans: 4;margin: 0.8em 0px;white-space: pre-wrap;color: rgb(51, 51, 51);font-family: &quot;Open Sans&quot;, &quot;Clear Sans&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span md-inline=\"plain\" style=\"box-sizing: border-box;\">\u540c\u6837\u7684\uff0c\u524d\u53f0\u4e5f\u9700\u8981\u5b9a\u65f6\u5fc3\u8df3WebSocket\uff0c\u8fd9\u91cc\u4e0d\u505a\u8d58\u8ff0\u3002<\/span><\/p>\n<h1 cid=\"n33\" mdtype=\"heading\" style=\"box-sizing: border-box;break-after: avoid-page;break-inside: avoid;orphans: 2;font-size: 2.25em;margin-top: 1rem;margin-bottom: 1rem;font-weight: bold;line-height: 1.2;cursor: text;padding-bottom: 0.3em;border-bottom: 1px solid rgb(238, 238, 238);white-space: pre-wrap;color: rgb(51, 51, 51);font-family: &quot;Open Sans&quot;, &quot;Clear Sans&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span md-inline=\"plain\" style=\"box-sizing: border-box;\">9. Bean\u6ce8\u5165<\/span><\/h1>\n<p cid=\"n34\" mdtype=\"paragraph\" style=\"box-sizing: border-box;orphans: 4;margin: 0.8em 0px;white-space: pre-wrap;color: rgb(51, 51, 51);font-family: &quot;Open Sans&quot;, &quot;Clear Sans&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span md-inline=\"plain\" style=\"box-sizing: border-box;\">WebSocket\u670d\u52a1\u7c7b\u4e2d\uff0c\u4f7f\u7528@Autowired\u76f4\u63a5\u6ce8\u5165Service\u6216\u666e\u901aBean\u65f6\uff0c\u4f1a\u62a5\u7a7a\u6307\u9488\u9519\u8bef\u3002\u8fd9\u662f\u56e0\u4e3aSpring\u7ba1\u7406\u5bf9\u8c61\u65f6\u4f7f\u7528\u5355\u4f8b\u6a21\u5f0f\uff0c\u4f46WebSocket\u670d\u52a1\u4e3a\u591a\u5bf9\u8c61\u3002<\/span><\/p>\n<p cid=\"n35\" mdtype=\"paragraph\" style=\"box-sizing: border-box;orphans: 4;margin: 0.8em 0px;white-space: pre-wrap;color: rgb(51, 51, 51);font-family: &quot;Open Sans&quot;, &quot;Clear Sans&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span md-inline=\"plain\" style=\"box-sizing: border-box;\">Spring Boot\u9879\u76ee\u5728\u542f\u52a8\u521d\u59cb\u5316\u65f6\uff0c\u4f1a\u521d\u59cb\u5316\u975e\u7528\u6237\u8fde\u63a5\u7684WebSocket\u670d\u52a1\uff0c\u4e3a\u5176\u6ce8\u5165Service\uff0c\u6b64\u65f6\u4f7f\u7528@Autowired\u6ce8\u5165\u7684Service\u4e0d\u4e3anull\uff0c\u5373\u88ab\u6210\u529f\u6ce8\u5165\u3002\u4f46\uff0cSpring\u9ed8\u8ba4\u7ba1\u7406\u7684\u662f\u5355\u4f8b\uff0c\u6240\u4ee5\u53ea\u4f1a\u6ce8\u5165\u4e00\u6b21Service\u3002\u5f53\u65b0\u7528\u6237\u8fde\u63a5\u65f6\uff0c\u7cfb\u7edf\u53c8\u4f1a\u521b\u5efa\u4e00\u4e2a\u65b0\u7684WebSocket\u5bf9\u8c61\uff0cSpring\u5c31\u4e0d\u4f1a\u7ed9\u7b2c\u4e8c\u4e2a WebSocket\u5bf9\u8c61\u6ce8\u5165Service\u4e86\uff0c\u6240\u4ee5\u5bfc\u81f4\u53ea\u8981\u662f\u7528\u6237\u8fde\u63a5\u521b\u5efa\u7684WebSocket \u5bf9\u8c61\uff0c\u90fd\u4e0d\u80fd\u518d\u6ce8\u5165\u4e86\u3002<\/span><\/p>\n<pre spellcheck=\"false\" lang=\"java\" cid=\"n36\" mdtype=\"fences\" style=\"box-sizing: border-box;overflow: visible;font-family: var(--monospace);font-size: 0.9em;display: block;break-inside: avoid;text-align: left;white-space: normal;background-image: inherit;background-position: inherit;background-size: inherit;background-repeat: inherit;background-attachment: inherit;background-origin: inherit;background-clip: inherit;background-color: rgb(248, 248, 248);border-width: 1px;border-style: solid;border-color: rgb(231, 234, 237);border-radius: 3px;padding: 8px 4px 6px 0px;margin-bottom: 15px;margin-top: 15px;width: inherit;color: rgb(51, 51, 51);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">org<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">slf4j<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Logger<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">org<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">slf4j<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">LoggerFactory<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">org<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">springframework<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">beans<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">factory<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">annotation<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Autowired<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">org<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">springframework<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">stereotype<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Component<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">javax<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">websocket<\/span>.<span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">*<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">javax<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">websocket<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">server<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">PathParam<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">javax<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">websocket<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">server<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">ServerEndpoint<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">java<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">io<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">IOException<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">java<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">util<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">HashMap<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">java<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">util<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Map<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">java<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">util<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">concurrent<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">ConcurrentHashMap<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">import<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">java<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">util<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">concurrent<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">atomic<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">AtomicInteger<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(85, 85, 85);\">@Component<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(85, 85, 85);\">@ServerEndpoint<\/span>(<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"\/websocket\/{terminalId}\"<\/span>)<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">public<\/span> <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">class<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 255);\">WebSocketService<\/span> {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span role=\"presentation\" cm-text=\"\t\" style=\"box-sizing: border-box;font-family: var(--monospace);display: inline-block;\">    <\/span><span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">\/\/code<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">\/**<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   <span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">* \u9700\u8981\u6ce8\u5165\u7684Service\u58f0\u660e\u4e3a\u9759\u6001\uff0c\u8ba9\u5176\u5c5e\u4e8e\u7c7b<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   <span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">*\/<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">private<\/span> <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">static<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">TerminalService<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">terminalService<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">\/**<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   <span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">* \u6ce8\u5165\u7684\u65f6\u5019\uff0c\u7ed9\u7c7b\u7684Service\u6ce8\u5165<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   <span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">*\/<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(85, 85, 85);\">@Autowired<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">public<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">void<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">setMchDeviceInfoService<\/span>(<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">TerminalService<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">terminalService<\/span>) {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">WebSocketService<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">terminalService<\/span> <span style=\"box-sizing: border-box;color: rgb(152, 26, 26);\">=<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">terminalService<\/span>;<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(85, 85, 85);\">@OnOpen<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">public<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">void<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">onOpen<\/span>(<span style=\"box-sizing: border-box;color: rgb(85, 85, 85);\">@PathParam<\/span>(<span style=\"box-sizing: border-box;color: rgb(170, 17, 17);\">\"terminalId\"<\/span>) <span style=\"box-sizing: border-box;color: rgb(0, 136, 85);\">String<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">terminalId<\/span>, <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Session<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">session<\/span>) <span style=\"box-sizing: border-box;color: rgb(119, 0, 136);\">throws<\/span> <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">Exception<\/span> {<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><span role=\"presentation\" cm-text=\"\t\" style=\"box-sizing: border-box;font-family: var(--monospace);display: inline-block;\">    <\/span><span role=\"presentation\" cm-text=\"\t\" style=\"box-sizing: border-box;font-family: var(--monospace);display: inline-block;\">    <\/span><span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">\/\/code<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">    <span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">terminalService<\/span>.<span style=\"box-sizing: border-box;color: rgb(0, 0, 0);\">terminal<\/span>();<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">   }<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">  <span style=\"box-sizing: border-box;color: rgb(170, 85, 0);\">\/\/code<\/span><\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">}<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\"><\/span><\/pre>\n<p cid=\"n82\" mdtype=\"paragraph\" style=\"box-sizing: border-box;orphans: 4;margin: 0.8em 0px;white-space: pre-wrap;color: rgb(51, 51, 51);font-family: &quot;Open Sans&quot;, &quot;Clear Sans&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span md-inline=\"plain\" style=\"box-sizing: border-box;\">\u6d4b\u8bd5\u65e5\u5fd7\u6253\u5370\u5982\u4e0b<\/span><\/p>\n<pre mdtype=\"fences\" cid=\"n83\" lang=\"\" spellcheck=\"false\" style=\"box-sizing: border-box;overflow: visible;font-family: var(--monospace);font-size: 0.9em;display: block;break-inside: avoid;text-align: left;white-space: normal;background-image: inherit;background-position: inherit;background-size: inherit;background-repeat: inherit;background-attachment: inherit;background-origin: inherit;background-clip: inherit;background-color: rgb(248, 248, 248);border-width: 1px;border-style: solid;border-color: rgb(231, 234, 237);border-radius: 3px;padding: 8px 4px 6px 0px;margin-bottom: 15px;margin-top: 15px;width: inherit;color: rgb(51, 51, 51);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">2022-07-02 21:26:08.166  INFO 9924 --- [nio-8090-exec-2] c.w.s.service.WebSocketService      : \/websocket\/123456\uff0c\u6253\u5f00\u8fde\u63a5\u5f00\u59cb\uff1a0<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">2022-07-02 21:26:08.166  INFO 9924 --- [nio-8090-exec-2] c.w.s.service.WebSocketService      : \/websocket\/123456\uff0c\u6253\u5f00\u8fde\u63a5\u5b8c\u6210\uff1a0<\/span><span role=\"presentation\" style=\"box-sizing: border-box;padding-right: 0.1px;\">2022-07-02 21:26:08.166  INFO 9924 --- [nio-8090-exec-2] c.w.s.service.TerminalService       : \u8fd9\u662f\u4e00\u6761\u6d4b\u8bd5\u65e5\u5fd7<\/span><\/pre>\n<p cid=\"n85\" mdtype=\"paragraph\" style=\"box-sizing: border-box;orphans: 4;margin: 0.8em 0px;white-space: pre-wrap;color: rgb(51, 51, 51);font-family: &quot;Open Sans&quot;, &quot;Clear Sans&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span md-inline=\"br\" spellcheck=\"false\" style=\"box-sizing: border-box;font-family: var(--monospace);opacity: 1;color: rgb(167, 167, 167);white-space: pre-wrap;\"><\/span><\/p>\n<hr style=\"box-sizing: content-box;height: 2px;margin: 16px 0px;border-width: 0px;border-style: none;border-color: initial;padding: 0px;background-color: rgb(231, 231, 231);overflow: hidden;\"  \/>\n<p cid=\"n92\" mdtype=\"paragraph\" style=\"box-sizing: border-box;orphans: 4;margin: 0.8em 0px;white-space: pre-wrap;color: rgb(51, 51, 51);font-family: &quot;Open Sans&quot;, &quot;Clear Sans&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span md-inline=\"plain\" style=\"box-sizing: border-box;\">GitHub\uff1a<\/span><span md-inline=\"link\" style=\"box-sizing: border-box;\"><span md-inline=\"plain\" style=\"box-sizing: border-box;\">https:\/\/github.com\/dkbnull\/SpringBootDemo<\/span><\/span><\/p>\n<p cid=\"n94\" mdtype=\"paragraph\" style=\"box-sizing: border-box;orphans: 4;margin: 0.8em 0px;white-space: pre-wrap;color: rgb(51, 51, 51);font-family: &quot;Open Sans&quot;, &quot;Clear Sans&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;\"><span md-inline=\"plain\" style=\"box-sizing: border-box;\">CSDN\uff1a<\/span><span md-inline=\"link\" style=\"box-sizing: border-box;\"><span md-inline=\"plain\" style=\"box-sizing: border-box;\">https:\/\/blog.csdn.net\/dkbnull\/article\/details\/125577993<\/span><\/span><\/p>\n<p style=\"text-align: center;margin-bottom: 0em;\"><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-galleryid=\"\" data-ratio=\"0.4488817891373802\" data-s=\"300,640\"  data-type=\"jpeg\" data-w=\"626\" style=\"\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524153122746.jpeg\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-galleryid=\"\" data-ratio=\"0.4488817891373802\" data-s=\"300,640\"  data-type=\"jpeg\" data-w=\"626\" style=\"\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524153122746.jpeg\"  \/><\/noscript><\/p>\n<blockquote>\n<p>\u672c\u7bc7\u6587\u7ae0\u6765\u6e90\u4e8e\u5fae\u4fe1\u516c\u4f17\u53f7:                 \u7a0b\u5e8f\u5458null              <\/p>\n<\/blockquote>\n<\/div>\n","raw":"","protected":false},"excerpt":{"rendered":"<p>\u5982\u679c\u6559\u7a0b\u4e2d\u4ee3\u7801\u4e0d\u4fbf\u4e8e\u9605\u8bfb\uff0c\u8bf7\u4f7f\u7528\u7535\u8111\u67e5\u770b\u6216\u70b9\u51fb\u9605\u8bfb\u539f\u6587\u3002 0. \u5f00\u53d1\u73af\u5883 JDK\uff1a1.8 Spring Boot\uff1a2.1.1.RE &#8230;<\/p>\n","protected":false},"author":1,"featured_media":4346,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"emotion":"","emotion_color":"","title_style":"","license":"","footnotes":""},"categories":[7,37],"tags":[],"class_list":["post-4353","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-spring-boot","category-websocket"],"post_thumbnail_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524153106628-150x150.jpeg","content_first_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524153112733.png","post_medium_image_300":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524153106628-300x127.jpeg","post_thumbnail_image_624":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524153106628-1024x435.jpeg","post_frist_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524153112733.png","post_medium_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524153106628-300x127.jpeg","post_large_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524153106628-1024x435.jpeg","post_full_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524153106628.jpeg","post_all_images":[{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524153112733.png","id":"image0"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524153112733.png","id":"image1"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524153115476.png","id":"image2"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524153115476.png","id":"image3"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524153118792.png","id":"image4"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524153118792.png","id":"image5"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524153122746.jpeg","id":"image6"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524153122746.jpeg","id":"image7"}],"videoAdId":"","listAd":"0","listAdId":"","listAdEvery":6,"total_comments":0,"category_name":"Spring Boot","post_date":"2022-07-02","like_count":"0","praiseWord":"\u9f13\u52b1","copyright_state":"","excitationAd":"0","rewardedVideoAdId":"","detailAdId":"","detailAd":"0","enterpriseMinapp":"0","audios":[],"postImageUrl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230519082947553.jpg","avatarurls":[],"related_posts":null,"pageviews":265,"next_post_id":96,"next_post_title":"Spring boot\u5f15\u5165knife4j\u5e76\u914d\u7f6e","previous_post_id":4358,"previous_post_title":"Spring Boot \u6574\u5408Logback\u8bb0\u5f55\u65e5\u5fd7","_links":{"self":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/4353","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/comments?post=4353"}],"version-history":[{"count":0,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/4353\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media\/4346"}],"wp:attachment":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media?parent=4353"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/categories?post=4353"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/tags?post=4353"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}