{"id":238300,"date":"2022-04-30T09:50:45","date_gmt":"2022-04-30T01:50:45","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=238300"},"modified":"2022-04-19T11:53:03","modified_gmt":"2022-04-19T03:53:03","slug":"websocket-contact","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/websocket-contact.html","title":{"rendered":"\u4ec0\u4e48\u662fWebSocket\u534f\u8bae"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | WebSocket \u662fHTML5\u5f00\u59cb\u63d0\u4f9b\u7684\u4e00\u79cd\u6d4f\u89c8\u5668\u4e0e\u670d\u52a1\u5668\u95f4\u8fdb\u884c\u5168\u53cc\u5de5\u901a\u8baf\u7684\u7f51\u7edc\u6280\u672f,\u4e00\u79cd\u57fa\u4e8e TCP \u8fde\u63a5\u4e0a\u8fdb\u884c\u5168\u53cc\u5de5\u901a\u4fe1\u7684\u534f\u8bae\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n <\/p>\n \u968f\u7740\u79d1\u6280\u53d1\u5c55\uff0c\u4eba\u4eec\u9700\u6c42\u8d8a\u6765\u8d8a\u591a\uff0c\u751f\u6d3b\u7684\u65b9\u65b9\u9762\u9762\u90fd\u79bb\u4e0d\u5f00\u4e00\u4e9b\u5b9e\u65f6\u4fe1\u606f\u3002\u6bd4\u5982\uff1a\u75ab\u60c5\u671f\u95f4\u5728\u5bb6\u534f\u540c\u529e\u516c\u3001\u75ab\u60c5\u76d1\u63a7\u76ee\u6807\u4eba\u7684\u5b9e\u65f6\u8fd0\u52a8\u8f68\u8ff9\u3001\u793e\u4ea4\u4e2d\u7684\u5b9e\u65f6\u6d88\u606f\u3001\u591a\u73a9\u5bb6\u4e92\u52a8\u6e38\u620f\u3001\u6bcf\u79d2\u77ac\u606f\u4e07\u53d8\u7684\u80a1\u5e02\u57fa\u91d1\u62a5\u4ef7\u3001\u4f53\u80b2\u5b9e\u51b5\u64ad\u653e\u3001\u97f3\u89c6\u9891\u804a\u5929\u3001\u89c6\u9891\u4f1a\u8bae\u3001\u5728\u7ebf\u6559\u80b2\u7b49\u7b49\uff0c\u90fd\u53ef\u4ee5\u501f\u7528WebSocket TCP\u94fe\u63a5\u53ef\u4ee5\u8ba9\u6570\u636e\u98de\u8d77\u6765\u3002\u4e0b\u9762\u5c31\u804a\u4e00\u4e0bWebSocket\u534f\u8bae\u3002<\/p>\n WebSocket \u662fHTML5\u5f00\u59cb\u63d0\u4f9b\u7684\u4e00\u79cd\u6d4f\u89c8\u5668\u4e0e\u670d\u52a1\u5668\u95f4\u8fdb\u884c\u5168\u53cc\u5de5\u901a\u8baf\u7684\u7f51\u7edc\u6280\u672f,\u4e00\u79cd\u57fa\u4e8e TCP \u8fde\u63a5\u4e0a\u8fdb\u884c\u5168\u53cc\u5de5\u901a\u4fe1\u7684\u534f\u8bae\uff0c\u76f8\u5bf9\u4e8e HTTP \u8fd9\u79cd\u975e\u6301\u4e45\u7684\u534f\u8bae\u6765\u8bf4\uff0cWebSocket \u662f\u4e00\u4e2a\u6301\u4e45\u5316\u7f51\u7edc\u901a\u4fe1\u7684\u534f\u8bae\u3002\u4f9d\u9760\u8fd9\u79cd\u6280\u672f\u53ef\u4ee5\u5b9e\u73b0\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\u7aef\u7684\u957f\u8fde\u63a5\uff0c\u53cc\u5411\u5b9e\u65f6\u901a\u4fe1\u3002<\/p>\n \u5b83\u4e0d\u4ec5\u53ef\u4ee5\u5b9e\u73b0\u5ba2\u6237\u7aef\u8bf7\u6c42\u670d\u52a1\u5668\uff0c\u540c\u65f6\u53ef\u4ee5\u5141\u8bb8\u670d\u52a1\u7aef\u4e3b\u52a8\u5411\u5ba2\u6237\u7aef\u63a8\u9001\u6570\u636e\u3002\u662f\u771f\u6b63\u7684\u53cc\u5411\u5e73\u7b49\u5bf9\u8bdd\uff0c\u5c5e\u4e8e\u670d\u52a1\u5668\u63a8\u9001\u6280\u672f\u7684\u4e00\u79cd\u3002\u5728 WebSocket API \u4e2d\uff0c\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\u53ea\u9700\u8981\u5b8c\u6210\u4e00\u6b21\u63e1\u624b\uff0c\u4e24\u8005\u4e4b\u95f4\u5c31\u76f4\u63a5\u53ef\u4ee5\u521b\u5efa\u6301\u4e45\u6027\u7684\u8fde\u63a5\uff0c\u5e76\u8fdb\u884c\u53cc\u5411\u6570\u636e\u4f20\u8f93\u3002<\/p>\n \u300c\u5176\u4ed6\u7279\u70b9\u5305\u62ec\uff1a\u300d<\/p>\n ws:\/\/xxx.ayunw.cn:80\/some\/path\r\nwss:\/\/xxx.ayunw.cn:443\/some\/path<\/pre>\n |