{"id":31321,"date":"2025-11-25T05:22:03","date_gmt":"2025-11-25T05:22:03","guid":{"rendered":"https:\/\/www.dotcom-monitor.com\/blog\/what-is-a-websocket\/"},"modified":"2026-06-15T16:47:19","modified_gmt":"2026-06-15T16:47:19","slug":"what-is-a-websocket","status":"publish","type":"post","link":"https:\/\/www.dotcom-monitor.com\/blog\/ja\/what-is-a-websocket\/","title":{"rendered":"WebSocket\u3068\u306f\u4f55\u304b\uff1f \u30d7\u30ed\u30c8\u30b3\u30eb\u3001API\u3001\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u63a5\u7d9a\u306e\u89e3\u8aac"},"content":{"rendered":"
<\/p>\n
WebSockets<\/b>\u306f\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\uff08\u30a6\u30a7\u30d6\u30d6\u30e9\u30a6\u30b6\u306a\u3069\uff09\u3068\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u30b5\u30fc\u30d0\u30fc\u306e\u9593\u3067\u3001\u5358\u4e00\u306e\u6301\u7d9a\u7684\u306aTCP\u63a5\u7d9a<\/b>\u3092\u4ecb\u3057\u3066\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u306e\u53cc\u65b9\u5411\u30a4\u30f3\u30bf\u30e9\u30af\u30b7\u30e7\u30f3<\/b>\u3092\u53ef\u80fd\u306b\u3059\u308b\u6700\u65b0\u306e\u30a6\u30a7\u30d6\u901a\u4fe1\u30d7\u30ed\u30c8\u30b3\u30eb\u3067\u3059\u3002<\/p>\n
\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304c\u30b5\u30fc\u30d0\u30fc\u306b\u7e70\u308a\u8fd4\u3057\u66f4\u65b0\u3092\u554f\u3044\u5408\u308f\u305b\u308b\u3053\u3068\u3092\u524d\u63d0\u3068\u3059\u308b\u5f93\u6765\u306eHTTP<\/b>\u306e\u3088\u3046\u306a\u30ea\u30af\u30a8\u30b9\u30c8-\u30ec\u30b9\u30dd\u30f3\u30b9\u30e2\u30c7\u30eb<\/b>\u3068\u306f\u7570\u306a\u308a\u3001WebSockets\u306f\u7d99\u7d9a\u7684\u306a\u63a5\u7d9a\u3092\u78ba\u7acb\u3057\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3068\u30b5\u30fc\u30d0\u30fc\u306e\u53cc\u65b9\u304c\u3044\u3064\u3067\u3082\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u9001\u53d7\u4fe1\u3067\u304d\u308b<\/b>\u3088\u3046\u306b\u3057\u307e\u3059\u3002\u3053\u306e\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u306a\u30c7\u30fc\u30bf\u4ea4\u63db\u306b\u3088\u308a\u3001\u7d76\u3048\u9593\u306a\u3044\u30dd\u30fc\u30ea\u30f3\u30b0\u3084\u30da\u30fc\u30b8\u30ea\u30d5\u30ec\u30c3\u30b7\u30e5\u306b\u3088\u308b\u9045\u5ef6\u304c\u89e3\u6d88\u3055\u308c\u307e\u3059\u3002<\/p>\n
\u305d\u306e\u52b9\u7387\u6027\u3068\u5fdc\u7b54\u6027\u306e\u305f\u3081\u306b\u3001WebSockets\u306f\u5373\u6642\u66f4\u65b0\u304c\u5fc5\u8981\u306a\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3<\/b>\u3001\u4f8b\u3048\u3070\u30e9\u30a4\u30d6\u30c1\u30e3\u30c3\u30c8\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u3001\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u3001\u30de\u30eb\u30c1\u30d7\u30ec\u30a4\u30e4\u30fc\u30b2\u30fc\u30e0\u3001\u30b3\u30e9\u30dc\u30ec\u30fc\u30b7\u30e7\u30f3\u30c4\u30fc\u30eb\u3001\u682a\u4fa1\u30d5\u30a3\u30fc\u30c9<\/b>\u306a\u3069\u306b\u6700\u9069\u3067\u3059\u3002<\/p>\n
\u901a\u4fe1\u30c1\u30e3\u30cd\u30eb\u3092\u958b\u3044\u305f\u307e\u307e\u306b\u3059\u308b\u3053\u3068\u3067\u3001WebSockets\u306f\u30b7\u30fc\u30e0\u30ec\u30b9\u3067\u30a4\u30d9\u30f3\u30c8\u99c6\u52d5\u306e\u30a4\u30f3\u30bf\u30e9\u30af\u30b7\u30e7\u30f3<\/b>\u3092\u5b9f\u73fe\u3057\u3001\u958b\u767a\u8005\u304c\u3088\u308a\u9ad8\u901f\u3067\u9b45\u529b\u7684\u3001\u304b\u3064\u9ad8\u5ea6\u306b\u30a4\u30f3\u30bf\u30e9\u30af\u30c6\u30a3\u30d6\u306a\u30a6\u30a7\u30d6\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3<\/b>\u3092\u69cb\u7bc9\u3059\u308b\u306e\u306b\u5f79\u7acb\u3061\u307e\u3059\u3002<\/p>\nWebSockets\u306e\u4ed5\u7d44\u307f<\/h2>\n
\u63a5\u7d9a\u306e\u78ba\u7acb<\/h3>\n
WebSocket\u63a5\u7d9a<\/b>\u306f\u3001\u30cf\u30f3\u30c9\u30b7\u30a7\u30a4\u30af\uff08handshake\uff09<\/b>\u3068\u547c\u3070\u308c\u308b\u30d7\u30ed\u30bb\u30b9\u304b\u3089\u59cb\u307e\u308a\u307e\u3059\u3002\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\uff08\u901a\u5e38\u306f\u30a6\u30a7\u30d6\u30d6\u30e9\u30a6\u30b6\uff09\u306f\u3001Upgrade<\/b>\u30d8\u30c3\u30c0\u30fc\u304c “websocket” \u306b\u8a2d\u5b9a\u3055\u308c\u305fHTTP\u30ea\u30af\u30a8\u30b9\u30c8<\/b>\u3092\u30b5\u30fc\u30d0\u30fc\u306b\u9001\u4fe1\u3057\u3001\u6a19\u6e96\u306eHTTP\u30d7\u30ed\u30c8\u30b3\u30eb\u304b\u3089WebSocket\u30d7\u30ed\u30c8\u30b3\u30eb<\/b>\u3078\u306e\u5207\u308a\u66ff\u3048\u3092\u8981\u6c42\u3057\u307e\u3059\u3002<\/p>\n
\u3053\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u306b\u306f\u3001\u30a2\u30c3\u30d7\u30b0\u30ec\u30fc\u30c9\u30d7\u30ed\u30bb\u30b9\u3092\u78ba\u8a8d\u3059\u308b\u305f\u3081\u306eConnection: Upgrade<\/b>\u30d8\u30c3\u30c0\u30fc\u3082\u542b\u307e\u308c\u307e\u3059\u3002\u30b5\u30fc\u30d0\u30fc\u304cWebSockets\u3092\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u308b\u5834\u5408\u3001101 Switching Protocols<\/b>\u306e\u30b9\u30c6\u30fc\u30bf\u30b9\u30b3\u30fc\u30c9\u3068Upgrade: websocket<\/b>\u30d8\u30c3\u30c0\u30fc\u3067\u5fdc\u7b54\u3057\u307e\u3059\u3002\u3053\u306e\u30cf\u30f3\u30c9\u30b7\u30a7\u30a4\u30af\u304c\u5b8c\u4e86\u3059\u308b\u3068\u3001\u63a5\u7d9a\u306fHTTP\u304b\u3089WebSocket\u306b\u6b63\u5e38\u306b\u30a2\u30c3\u30d7\u30b0\u30ec\u30fc\u30c9\u3055\u308c\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3068\u30b5\u30fc\u30d0\u30fc\u9593\u306b\u6301\u7d9a\u7684\u3067\u5168\u4e8c\u91cd\u306e\u901a\u4fe1\u30c1\u30e3\u30cd\u30eb<\/b>\u304c\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n\u5168\u4e8c\u91cd\u901a\u4fe1\uff08Full-Duplex Communication\uff09<\/h3>\n
\u63a5\u7d9a\u304c\u78ba\u7acb\u3055\u308c\u308b\u3068\u3001WebSockets\u306f\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3068\u30b5\u30fc\u30d0\u30fc\u9593\u306e\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u306a\u53cc\u65b9\u5411\u30c7\u30fc\u30bf\u8ee2\u9001\u3092\u53ef\u80fd\u306b\u3057\u307e\u3059<\/b>\u3002\u8981\u6c42\u3068\u5fdc\u7b54\u306b\u53b3\u5bc6\u306b\u5f93\u3046\u5f93\u6765\u306eHTTP\u3068\u306f\u7570\u306a\u308a\u3001WebSockets\u3067\u306f\u53cc\u65b9\u304c\u540c\u6642\u306b\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u9001\u53d7\u4fe1\u3067\u304d\u307e\u3059<\/b>\u3002<\/p>\n
\u3053\u306e\u53cc\u65b9\u5411\u901a\u4fe1<\/b>\u306f\u3001\u3044\u305a\u308c\u304b\u306e\u5074\u304c\u63a5\u7d9a\u3092\u9589\u3058\u308b\u3053\u3068\u3092\u6c7a\u3081\u308b\u307e\u3067\u7d99\u7d9a\u3057\u307e\u3059\u3002\u3055\u3089\u306b\u3001WebSockets\u306f\u57fa\u790e\u3068\u306a\u308bWebSocket\u30d7\u30ed\u30c8\u30b3\u30eb\u306e\u4e0a\u306b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u56fa\u6709\u306e\u901a\u4fe1\u30eb\u30fc\u30eb\u3092\u5b9a\u7fa9\u3059\u308b\u30b5\u30d6\u30d7\u30ed\u30c8\u30b3\u30eb\uff08subprotocols\uff09<\/b>\u3092\u4f7f\u7528\u3067\u304d\u3001\u8907\u96d1\u306a\u30c7\u30fc\u30bf\u30d5\u30ed\u30fc\u3084\u5c02\u7528\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u5f62\u5f0f\u306e\u51e6\u7406\u3092\u5bb9\u6613\u306b\u3057\u307e\u3059\u3002<\/p>\n\u30e1\u30c3\u30bb\u30fc\u30b8\u306e\u30d5\u30ec\u30fc\u30df\u30f3\u30b0\uff08Message Framing\uff09<\/h3>\n
WebSocket\u901a\u4fe1\u306f\u30e1\u30c3\u30bb\u30fc\u30b8\u306e\u30d5\u30ec\u30fc\u30df\u30f3\u30b0<\/b>\u306b\u3088\u3063\u3066\u69cb\u6210\u3055\u308c\u3001\u30c7\u30fc\u30bf\u304c\u52b9\u7387\u7684\u304b\u3064\u4fe1\u983c\u6027\u3092\u4fdd\u3063\u3066\u9001\u4fe1\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002\u5404WebSocket\u30e1\u30c3\u30bb\u30fc\u30b8\u306f\u4ee5\u4e0b\u3067\u69cb\u6210\u3055\u308c\u307e\u3059\uff1a<\/p>\n \u30d5\u30ec\u30fc\u30e0\u306b\u306f\u30c6\u30ad\u30b9\u30c8<\/b>\u3001\u30d0\u30a4\u30ca\u30ea\u30c7\u30fc\u30bf<\/b>\u3001\u307e\u305f\u306f\u63a5\u7d9a\u7ba1\u7406\u306b\u4f7f\u7528\u3055\u308c\u308b\u5236\u5fa1\u30d5\u30ec\u30fc\u30e0<\/b>\uff08ping\u3001pong\u3001close\u306a\u3069\uff09\u3092\u542b\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3053\u306e\u69cb\u9020\u306b\u3088\u308a\u3001\u30aa\u30fc\u30d0\u30fc\u30d8\u30c3\u30c9\u3092\u6700\u5c0f\u9650\u306b\u6291\u3048\u305f\u8efd\u91cf\u306a\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u901a\u4fe1\u304c\u53ef\u80fd\u3068\u306a\u308a\u3001\u6027\u80fd\u304c\u91cd\u8981\u306a\u30a6\u30a7\u30d6\u304a\u3088\u3073\u30e2\u30d0\u30a4\u30eb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u6700\u9069\u3067\u3059\u3002<\/p>\n WebSocket\u30d7\u30ed\u30c8\u30b3\u30eb<\/b>\u306e\u4e3b\u306a\u5229\u70b9\u306f\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3068\u30b5\u30fc\u30d0\u30fc\u9593\u3067\u771f\u306e\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u901a\u4fe1<\/b>\u3092\u63d0\u4f9b\u3067\u304d\u308b\u3053\u3068\u3067\u3059\u3002WebSocket\u63a5\u7d9a<\/b>\u304c\u78ba\u7acb\u3055\u308c\u308b\u3068\u3001\u7e70\u308a\u8fd4\u3057\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u5f85\u305f\u305a\u306b\u30c7\u30fc\u30bf\u304c\u5373\u5ea7\u306b\u53cc\u65b9\u5411\u3078\u6d41\u308c\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30e9\u30a4\u30d6\u30c1\u30e3\u30c3\u30c8\u30a2\u30d7\u30ea\u3001\u30de\u30eb\u30c1\u30d7\u30ec\u30a4\u30e4\u30fc\u30b2\u30fc\u30e0\u3001\u30c8\u30ec\u30fc\u30c7\u30a3\u30f3\u30b0\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u3001\u30b3\u30e9\u30dc\u30ec\u30fc\u30b7\u30e7\u30f3\u30c4\u30fc\u30eb<\/b>\u306a\u3069\u3001\u5373\u6642\u306e\u66f4\u65b0\u304c\u30e6\u30fc\u30b6\u30fc\u4f53\u9a13\u306b\u4e0d\u53ef\u6b20\u306a\u7528\u9014\u306b\u6700\u9069\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n \u5f93\u6765\u306eHTTP\u63a5\u7d9a\u306f\u3001\u5404\u30e1\u30c3\u30bb\u30fc\u30b8\u3054\u3068\u306b\u65b0\u3057\u3044\u30ea\u30af\u30a8\u30b9\u30c8-\u30ec\u30b9\u30dd\u30f3\u30b9\u30b5\u30a4\u30af\u30eb\u304c\u5fc5\u8981\u306a\u305f\u3081\u30ec\u30a4\u30c6\u30f3\u30b7\u3092\u751f\u307f\u307e\u3059\u3002WebSockets<\/b>\u306f\u6301\u7d9a\u7684\u306a\u63a5\u7d9a<\/b>\u3092\u7dad\u6301\u3059\u308b\u305f\u3081\u3001\u7e70\u308a\u8fd4\u3057\u306e\u30cf\u30f3\u30c9\u30b7\u30a7\u30a4\u30af\u304c\u4e0d\u8981\u306b\u306a\u308a\u3001\u30e1\u30c3\u30bb\u30fc\u30b8\u914d\u4fe1\u304c\u901f\u304f<\/b>\u3001\u3088\u308a\u5fdc\u7b54\u6027\u306e\u9ad8\u3044\u4f53\u9a13<\/b>\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002\u7279\u306b\u91d1\u878d\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u3084\u76e3\u8996\u30c4\u30fc\u30eb\u306e\u3088\u3046\u306b\u30df\u30ea\u79d2\u5358\u4f4d\u304c\u91cd\u8981\u306a\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u52b9\u679c\u3092\u767a\u63ee\u3057\u307e\u3059\u3002<\/p>\n \u5404\u30ea\u30af\u30a8\u30b9\u30c8\u3067\u5927\u91cf\u306e\u30d8\u30c3\u30c0\u30fc\u3092\u9001\u308bHTTP\u3068\u306f\u7570\u306a\u308a\u3001WebSockets\u306f\u5fc5\u8981\u306a\u30da\u30a4\u30ed\u30fc\u30c9\u306e\u307f\u3092\u9001\u4fe1\u3057\u307e\u3059<\/b>\u3002\u4e0d\u8981\u306a\u30aa\u30fc\u30d0\u30fc\u30d8\u30c3\u30c9\u3092\u6392\u9664\u3059\u308b\u3053\u3068\u3067\u3001\u5e2f\u57df\u5e45\u306e\u6d88\u8cbb\u3092\u6700\u5c0f\u9650\u306b\u6291\u3048\u3001\u30c7\u30fc\u30bf\u8ee2\u9001\u306e\u52b9\u7387\u3092\u6700\u9069\u5316<\/b>\u3057\u307e\u3059\u3002IoT\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u3001\u901a\u77e5\u30b7\u30b9\u30c6\u30e0\u3001\u30e9\u30a4\u30d6\u5206\u6790\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u306e\u3088\u3046\u306b\u983b\u7e41\u306b\u66f4\u65b0\u3092\u30d7\u30c3\u30b7\u30e5\u3059\u308b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u306f\u7279\u306b\u6709\u76ca\u3067\u3059\u3002<\/p>\n WebSocket\u30b5\u30fc\u30d0\u30fc<\/b>\u306f\u6570\u5343\u306e\u540c\u6642\u63a5\u7d9a<\/b>\u3092\u52b9\u7387\u7684\u306b\u6271\u3046\u3088\u3046\u306b\u8a2d\u8a08\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u5404\u63a5\u7d9a\u304c\u958b\u3044\u305f\u307e\u307e\u3067\u3042\u308b\u305f\u3081\u3001\u30b5\u30fc\u30d0\u30fc\u306f\u63a5\u7d9a\u306e\u983b\u7e41\u306a\u4f5c\u6210\u30fb\u7834\u68c4\u306e\u30aa\u30fc\u30d0\u30fc\u30d8\u30c3\u30c9\u306a\u3057\u306b\u591a\u6570\u306e\u30e6\u30fc\u30b6\u30fc\u3068\u540c\u6642\u306b\u901a\u4fe1\u3067\u304d\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30de\u30a4\u30af\u30ed\u30b5\u30fc\u30d3\u30b9<\/b>\u3001\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0API<\/b>\u3001\u30af\u30e9\u30a6\u30c9\u30cd\u30a4\u30c6\u30a3\u30d6\u30b7\u30b9\u30c6\u30e0<\/b>\u306a\u3069\u30a4\u30d9\u30f3\u30c8\u99c6\u52d5\u578b\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\u306b\u6700\u9069\u306a\u9078\u629e\u80a2\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n WebSockets<\/b>\u306f\u73fe\u4ee3\u306e\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u30c1\u30e3\u30c3\u30c8\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3<\/b>\u306e\u57fa\u76e4\u3067\u3059\u3002\u30da\u30fc\u30b8\u306e\u518d\u8aad\u307f\u8fbc\u307f\u3084\u7e70\u308a\u8fd4\u3057\u306eHTTP\u30ea\u30af\u30a8\u30b9\u30c8\u306a\u3057\u3067\u30e6\u30fc\u30b6\u30fc\u9593\u306b\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u5373\u6642\u914d\u4fe1\u3067\u304d\u307e\u3059\u30021\u5bfe1\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u30f3\u30b0<\/b>\u3067\u3082\u30b0\u30eb\u30fc\u30d7\u30c1\u30e3\u30c3\u30c8<\/b>\u3067\u3082\u3001WebSocket\u30d7\u30ed\u30c8\u30b3\u30eb<\/b>\u306f\u77ac\u6642\u304b\u3064\u81ea\u7136\u306b\u611f\u3058\u3089\u308c\u308b\u6ed1\u3089\u304b\u306a\u53cc\u65b9\u5411\u901a\u4fe1\u3092\u4fdd\u8a3c\u3057\u307e\u3059\u3002<\/p>\n \u30cb\u30e5\u30fc\u30b9\u30dd\u30fc\u30bf\u30eb\u3001\u30bd\u30fc\u30b7\u30e3\u30eb\u30e1\u30c7\u30a3\u30a2\u3001\u30e9\u30a4\u30d6\u30b9\u30dd\u30fc\u30c4\u306e\u30b9\u30b3\u30a2\u30dc\u30fc\u30c9<\/b>\u306e\u3088\u3046\u306b\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u66f4\u65b0<\/b>\u3092\u5fc5\u8981\u3068\u3059\u308b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u306f\u3001WebSockets<\/b>\u304c\u6700\u9069\u3067\u3059\u3002\u6301\u7d9a\u7684\u63a5\u7d9a<\/b>\u306b\u3088\u308a\u3001\u30c7\u30fc\u30bf\u304c\u5909\u308f\u3063\u305f\u77ac\u9593\u306b\u30b5\u30fc\u30d0\u30fc\u304c\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3078\u76f4\u63a5\u66f4\u65b0\u3092\u30d7\u30c3\u30b7\u30e5<\/b>\u3067\u304d\u3001\u9045\u5ef6\u3092\u6392\u9664\u3057\u3066\u30e6\u30fc\u30b6\u30fc\u306b\u5373\u6642\u306e\u60c5\u5831\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002<\/p>\n \u30de\u30eb\u30c1\u30d7\u30ec\u30a4\u30e4\u30fc\u30aa\u30f3\u30e9\u30a4\u30f3\u30b2\u30fc\u30e0<\/b>\u3067\u306f\u30df\u30ea\u79d2\u5358\u4f4d\u306e\u9045\u5ef6\u304c\u91cd\u8981\u3067\u3059\u3002WebSocket\u63a5\u7d9a<\/b>\u306f\u3001\u30b5\u30fc\u30d0\u30fc\u3068\u30d7\u30ec\u30a4\u30e4\u30fc\u9593\u3067\u4f4e\u30ec\u30a4\u30c6\u30f3\u30b7\u304b\u3064\u9ad8\u983b\u5ea6\u306e\u901a\u4fe1<\/b>\u3092\u5b9f\u73fe\u3057\u3001\u5404\u64cd\u4f5c\u3084\u30a4\u30d9\u30f3\u30c8\u3092\u77ac\u6642\u306b\u540c\u671f\u3055\u305b\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u3088\u308a\u6ed1\u3089\u304b\u3067\u6ca1\u5165\u611f\u306e\u3042\u308b\u30b2\u30fc\u30e0\u4f53\u9a13\u3092\u63d0\u4f9b\u3067\u304d\u307e\u3059\u3002<\/p>\n \u30aa\u30f3\u30e9\u30a4\u30f3\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u30a8\u30c7\u30a3\u30bf\u3001\u30c7\u30b8\u30bf\u30eb\u30db\u30ef\u30a4\u30c8\u30dc\u30fc\u30c9\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u7ba1\u7406\u30c4\u30fc\u30eb\u306a\u3069\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306f\u3001\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u30b3\u30e9\u30dc\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u7dad\u6301\u3059\u308b\u305f\u3081\u306bWebSocket API<\/b>\u306b\u5927\u304d\u304f\u4f9d\u5b58\u3057\u3066\u3044\u307e\u3059\u3002WebSockets\u306b\u3088\u308a\u8907\u6570\u306e\u30e6\u30fc\u30b6\u30fc\u304c\u540c\u6642\u306b\u7de8\u96c6\u3084\u63cf\u753b\u3001\u66f4\u65b0\u3092\u884c\u3063\u3066\u3082\u3001\u5168\u54e1\u306e\u8868\u793a\u304c\u9045\u5ef6\u306a\u304f\u540c\u671f\u3055\u308c\u307e\u3059\u3002<\/p>\n \u91d1\u878d\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u306fWebSockets<\/b>\u3092\u4f7f\u7528\u3057\u3066\u3001\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u306e\u5e02\u5834\u30c7\u30fc\u30bf<\/b>\u3001\u682a\u4fa1\u3001\u304a\u3088\u3073\u30c8\u30ec\u30fc\u30c9\u306e\u66f4\u65b0\u3092\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u3084\u30e2\u30d0\u30a4\u30eb\u30a2\u30d7\u30ea\u306b\u30b9\u30c8\u30ea\u30fc\u30e0\u914d\u4fe1\u3057\u307e\u3059\u3002\u3053\u306e\u5373\u6642\u6027\u306e\u9ad8\u3044\u30c7\u30fc\u30bf\u30d5\u30ed\u30fc\u306b\u3088\u308a\u3001\u30c8\u30ec\u30fc\u30c0\u30fc\u3084\u6295\u8cc7\u5bb6\u306f\u6700\u65b0\u306e\u60c5\u5831\u306b\u57fa\u3065\u3044\u3066\u77ac\u6642\u306e\u610f\u601d\u6c7a\u5b9a<\/b>\u3092\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n \u4eca\u3059\u3050 WebSocket \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u76e3\u8996\u3068\u30c6\u30b9\u30c8\u3092\u958b\u59cb<\/p>\n \u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u3059\u308b\u3053\u3068\u306f\u59cb\u307e\u308a\u306b\u904e\u304e\u307e\u305b\u3093\u3002\u9577\u671f\u7684\u306a\u6210\u529f\u306e\u305f\u3081\u306b\u306f\u3001\u305d\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u78ba\u5b9f\u306b\u3059\u308b\u3053\u3068\u304c\u4e0d\u53ef\u6b20\u3067\u3059\u3002Dotcom-Monitor \u306e\u6700\u65b0\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u306f EveryStep \u30b9\u30af\u30ea\u30d7\u30c6\u30a3\u30f3\u30b0\u30c4\u30fc\u30eb\u306b\u30d5\u30eb WebSocket \u30b5\u30dd\u30fc\u30c8\u3092\u5c0e\u5165\u3057\u3001WebSocket \u30d9\u30fc\u30b9\u306e\u64cd\u4f5c\u3092\u7c21\u5358\u306b\u8a18\u9332\u3001\u30c6\u30b9\u30c8\u3001\u76e3\u8996\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n WebSocket \u30b5\u30dd\u30fc\u30c8\u306e\u8a73\u7d30\u3092\u898b\u308b<\/a><\/p>\n \u305d\u3057\u3066\u3001WebSocket \u5bfe\u5fdc\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u6027\u80fd\u3068\u4fe1\u983c\u6027\u3092\u4eca\u65e5\u304b\u3089\u5411\u4e0a\u3055\u305b\u307e\u3057\u3087\u3046\u3002<\/p>\n<\/div>\n WebSockets \u3092\u59cb\u3081\u308b\u306b\u306f\u3001\u305d\u306e\u30d7\u30ed\u30c8\u30b3\u30eb\u3092\u6271\u3048\u308b\u30b5\u30fc\u30d0\u30fc\u304c\u5fc5\u8981\u3067\u3059\u3002\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u3044\u304f\u3064\u304b\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3068\u30e9\u30a4\u30d6\u30e9\u30ea\u304c\u3053\u306e\u30d7\u30ed\u30bb\u30b9\u3092\u7c21\u7d20\u5316\u3057\u307e\u3059\uff1a<\/p>\n \u3053\u308c\u3089\u306e\u5404\u30bd\u30ea\u30e5\u30fc\u30b7\u30e7\u30f3\u306f\u3001\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u901a\u4fe1\u30c1\u30e3\u30cd\u30eb\u306e\u7ba1\u7406\u3001\u540c\u6642\u63a5\u7d9a\u30e6\u30fc\u30b6\u30fc\u306e\u51e6\u7406\u3001\u63a5\u7d9a\u3055\u308c\u305f\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u9593\u306e\u4fe1\u983c\u6027\u306e\u3042\u308b\u30e1\u30c3\u30bb\u30fc\u30b8\u914d\u4fe1\u3092\u78ba\u4fdd\u3059\u308b\u305f\u3081\u306e\u30c4\u30fc\u30eb\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002<\/p>\n \u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u5074\u3067\u306f\u3001\u73fe\u4ee3\u306e\u30d6\u30e9\u30a6\u30b6\u306f WebSocket API<\/b> \u3092\u30cd\u30a4\u30c6\u30a3\u30d6\u306b\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u307e\u3059\u3002\u308f\u305a\u304b\u6570\u884c\u306e JavaScript \u3067 WebSocket \u63a5\u7d9a\u3092\u78ba\u7acb\u3057\u3066\u64cd\u4f5c\u3067\u304d\u307e\u3059\uff1a<\/p>\n \u3053\u306e\u30b7\u30f3\u30d7\u30eb\u306a\u4f8b\u306f\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304c\u3069\u306e\u3088\u3046\u306b\u6301\u7d9a\u7684\u306a\u63a5\u7d9a\u3092\u958b\u304d\u3001\u30c7\u30fc\u30bf\u3092\u9001\u4fe1\u3057\u3001\u7740\u4fe1\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u5f85\u3061\u53d7\u3051\u308b\u304b\u3092\u793a\u3057\u3066\u304a\u308a\u3001\u30a6\u30a7\u30d6\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u306e\u30a4\u30f3\u30bf\u30e9\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\u3092\u63d0\u4f9b\u3059\u308b\u57fa\u790e\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n WebSocket \u30e1\u30c3\u30bb\u30fc\u30b8\u306f\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u5074\u3068\u30b5\u30fc\u30d0\u30fc\u5074\u306e\u4e21\u65b9\u3067\u30a4\u30d9\u30f3\u30c8\u30ea\u30b9\u30ca\u30fc\u3092\u4f7f\u7528\u3057\u3066\u7ba1\u7406\u3055\u308c\u307e\u3059\u3002message<\/b> \u30a4\u30d9\u30f3\u30c8\u306b\u3088\u308a\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306f\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u3067\u30c7\u30fc\u30bf\u3092\u53d7\u4fe1\u3057\u3066\u51e6\u7406\u3067\u304d\u307e\u3059\u3002\u30e1\u30c3\u30bb\u30fc\u30b8\u306f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u8981\u4ef6\u306b\u5fdc\u3058\u3066\u30c6\u30ad\u30b9\u30c8<\/b>\u307e\u305f\u306f\u30d0\u30a4\u30ca\u30ea\u30c7\u30fc\u30bf<\/b>\u3068\u3057\u3066\u9001\u4fe1\u3067\u304d\u307e\u3059\u3002<\/p>\n \u69cb\u9020\u5316\u3055\u308c\u305f\u901a\u4fe1\u306b\u306f\u3001\u8efd\u91cf\u3067\u8aad\u307f\u3084\u3059\u3044\u30c7\u30fc\u30bf\u4ea4\u63db\u624b\u6bb5\u3067\u3042\u308bJSON<\/b>\u304c\u6700\u3082\u4e00\u822c\u7684\u306b\u4f7f\u7528\u3055\u308c\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3068\u30b5\u30fc\u30d0\u30fc\u9593\u3067\u306e\u69cb\u9020\u5316\u3055\u308c\u305f\u8907\u96d1\u306a\u30c7\u30fc\u30bf\u306e\u3084\u308a\u53d6\u308a\u304c\u5bb9\u6613\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n \u4ee5\u4e0b\u306f\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u5074\u3067\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u51e6\u7406\u306e\u4f8b\u3067\u3059\uff1a<\/p>\n \u30b5\u30fc\u30d0\u30fc\u5074\u3067\u306f\u3001WebSocket \u30e9\u30a4\u30d6\u30e9\u30ea\u304c\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u30ea\u30c3\u30b9\u30f3\u3057\u3001\u305d\u306e\u5185\u5bb9\u3092\u89e3\u6790\u3057\u3066\u9069\u5207\u306a\u5fdc\u7b54\u3092\u9001\u308b\u305f\u3081\u306e\u5bfe\u5fdc\u3059\u308b\u30a4\u30d9\u30f3\u30c8\u30cf\u30f3\u30c9\u30e9\u30fc\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002\u3053\u306e\u53cc\u65b9\u5411\u901a\u4fe1\u306b\u3088\u308a\u3001\u9ad8\u901f\u3067\u52d5\u7684\u3001\u304b\u3064\u9ad8\u5ea6\u306b\u30a4\u30f3\u30bf\u30e9\u30af\u30c6\u30a3\u30d6\u306a\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u69cb\u7bc9\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n WebSocket API<\/b> \u306f\u3001\u958b\u767a\u8005\u304c\u4fe1\u983c\u6027\u306e\u9ad8\u3044\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u3059\u308b\u305f\u3081\u306e\u30c4\u30fc\u30eb\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3068\u30b5\u30fc\u30d0\u30fc\u9593\u306e\u901a\u4fe1\u3092\u3088\u308a\u67d4\u8edf\u304b\u3064\u52b9\u7387\u7684\u306b\u3059\u308b\u3055\u307e\u3056\u307e\u306a\u6a5f\u80fd\u3092\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n WebSockets \u306f\u3001\u57fa\u790e\u3068\u306a\u308b WebSocket \u63a5\u7d9a\u306e\u4e0a\u306b\u7279\u5b9a\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u5411\u3051\u306e\u901a\u4fe1\u30d7\u30ed\u30c8\u30b3\u30eb\u3067\u3042\u308b\u30b5\u30d6\u30d7\u30ed\u30c8\u30b3\u30eb<\/b>\u3092\u5b9a\u7fa9\u3067\u304d\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30e1\u30c3\u30bb\u30fc\u30b8\u4ea4\u63db\u306e\u305f\u3081\u306e\u69cb\u9020\u5316\u3055\u308c\u305f\u30a2\u30d7\u30ea\u56fa\u6709\u306e\u30eb\u30fc\u30eb\u3092\u78ba\u7acb\u3067\u304d\u3001\u8907\u96d1\u307e\u305f\u306f\u30c9\u30e1\u30a4\u30f3\u56fa\u6709\u306e\u30a4\u30f3\u30bf\u30e9\u30af\u30b7\u30e7\u30f3\u306e\u7ba1\u7406\u304c\u5bb9\u6613\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n WebSocket \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e readyState<\/b> \u30d7\u30ed\u30d1\u30c6\u30a3\u306f\u63a5\u7d9a\u306e\u73fe\u5728\u306e\u72b6\u614b\u3092\u793a\u3057\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u958b\u767a\u8005\u306f\u63a5\u7d9a\u306e\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u3092\u7ba1\u7406\u3057\u3001\u518d\u63a5\u7d9a\u30ed\u30b8\u30c3\u30af\u3092\u52b9\u679c\u7684\u306b\u6271\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\uff1a<\/p>\n \u5b89\u5168\u306a\u901a\u4fe1\u306e\u305f\u3081\u306b\u3001WebSocket \u8a8d\u8a3c<\/b> \u306f\u8a31\u53ef\u3055\u308c\u305f\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306e\u307f\u304c\u63a5\u7d9a\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002JWT \u3084 API \u30ad\u30fc\u306a\u3069\u306e\u8a8d\u8a3c\u30c8\u30fc\u30af\u30f3\u306f\u521d\u671f\u30cf\u30f3\u30c9\u30b7\u30a7\u30a4\u30af\u306e\u9593\u306b\u4ea4\u63db\u3067\u304d\u3001\u672a\u627f\u8a8d\u30a2\u30af\u30bb\u30b9\u3092\u9632\u304e\u3001\u6a5f\u5bc6\u30c7\u30fc\u30bf\u3092\u4fdd\u8b77\u3057\u307e\u3059\u3002<\/p>\n WebSockets \u306f\u30c6\u30ad\u30b9\u30c8\u3060\u3051\u3067\u306a\u304f \u30d0\u30a4\u30ca\u30ea\u30c7\u30fc\u30bf<\/b> \u3082\u6271\u3046\u3053\u3068\u304c\u3067\u304d\u3001\u30d5\u30a1\u30a4\u30eb\u3084\u753b\u50cf\u3001\u305d\u306e\u4ed6\u306e\u975e\u30c6\u30ad\u30b9\u30c8\u5f62\u5f0f\u3092\u52b9\u7387\u7684\u306b\u9001\u4fe1\u3067\u304d\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u3067\u306e\u9ad8\u901f\u30c7\u30fc\u30bf\u30b9\u30c8\u30ea\u30fc\u30df\u30f3\u30b0\u3092\u5fc5\u8981\u3068\u3059\u308b\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9\u306b\u3082\u9069\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n WebSockets \u306f\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u901a\u77e5<\/b>\u306b\u6700\u9069\u3067\u3059\u3002\u30b5\u30fc\u30d0\u30fc\u306f\u63a5\u7d9a\u4e2d\u306e\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306b\u5bfe\u3057\u3066\u5373\u5ea7\u306b\u66f4\u65b0\u3001\u30a2\u30e9\u30fc\u30c8\u3001\u307e\u305f\u306f\u72b6\u614b\u5909\u5316\u3092\u30d7\u30c3\u30b7\u30e5\u3067\u304d\u3001\u30e1\u30c3\u30bb\u30fc\u30b8\u30f3\u30b0\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u3084\u5e02\u5834\u306e\u66f4\u65b0\u3001\u30b7\u30b9\u30c6\u30e0\u76e3\u8996\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u306b\u9069\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n WebSocket API \u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u76e3\u8996\u30fb\u30c6\u30b9\u30c8\u3059\u308b<\/p>\n WebSocket \u63a5\u7d9a\u3092\u9ad8\u901f\u3067\u5b89\u5168\u304b\u3064\u4fe1\u983c\u6027\u306e\u9ad8\u3044\u72b6\u614b\u306b\u4fdd\u3064\u3053\u3068\u306f\u3001\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u901a\u4fe1\u306b\u304a\u3044\u3066\u91cd\u8981\u3067\u3059\u3002Dotcom-Monitor \u306e Synthetic Monitoring<\/a> \u3092\u4f7f\u3048\u3070\u3001WebSocket \u306e\u3084\u308a\u53d6\u308a\u3092\u30b7\u30df\u30e5\u30ec\u30fc\u30c8\u3057\u3001\u5fdc\u7b54\u6642\u9593\u3092\u6e2c\u5b9a\u3057\u3001\u30e6\u30fc\u30b6\u30fc\u306b\u5f71\u97ff\u304c\u51fa\u308b\u524d\u306b\u6027\u80fd\u4e0a\u306e\u30dc\u30c8\u30eb\u30cd\u30c3\u30af\u3092\u691c\u51fa\u3067\u304d\u307e\u3059\u3002<\/p>\n \u8907\u6570\u306e\u30b0\u30ed\u30fc\u30d0\u30eb\u62e0\u70b9\u304b\u3089\u306e\u81ea\u52d5\u30c6\u30b9\u30c8\u3067\u3001\u4eca\u65e5\u304b\u3089 WebSocket API \u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u6700\u9069\u5316\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<\/div>\n open\u3001close\u3001error \u30a4\u30d9\u30f3\u30c8\u3092\u9069\u5207\u306b\u51e6\u7406\u3057\u3066 WebSocket \u63a5\u7d9a\u3092\u52b9\u7387\u7684\u306b\u7ba1\u7406\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u4e88\u671f\u305b\u306c\u5207\u65ad\u306b\u5bfe\u51e6\u3059\u308b\u305f\u3081\u306b\u6307\u6570\u30d0\u30c3\u30af\u30aa\u30d5\u3092\u7528\u3044\u305f\u518d\u63a5\u7d9a\u30ed\u30b8\u30c3\u30af\u3092\u5b9f\u88c5\u3057\u3001\u30b7\u30fc\u30e0\u30ec\u30b9\u306a\u30e6\u30fc\u30b6\u30fc\u4f53\u9a13\u3092\u7dad\u6301\u3057\u307e\u3059\u3002<\/p>\n \u5e38\u306b\u5b89\u5168\u306a WebSockets\uff08wss:\/\/\uff09\u3092\u4f7f\u7528\u3057\u3066\u30c7\u30fc\u30bf\u3092\u6697\u53f7\u5316\u3057\u3001\u76d7\u8074\u3084\u4e2d\u9593\u8005\u653b\u6483\u3092\u9632\u3044\u3067\u304f\u3060\u3055\u3044\u3002\u3059\u3079\u3066\u306e\u53d7\u4fe1\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u691c\u8a3c\u304a\u3088\u3073\u30b5\u30cb\u30bf\u30a4\u30ba\u3057\u3066\u3001\u30a4\u30f3\u30b8\u30a7\u30af\u30b7\u30e7\u30f3\u3084\u30af\u30ed\u30b9\u30b5\u30a4\u30c8 WebSocket \u30cf\u30a4\u30b8\u30e3\u30c3\u30af\uff08CSWSH\uff09\u306a\u3069\u306e\u8106\u5f31\u6027\u304b\u3089\u4fdd\u8b77\u3057\u307e\u3059\u3002<\/p>\n \u30ed\u30fc\u30c9\u30d0\u30e9\u30f3\u30b5\u30fc\u3084\u30af\u30e9\u30b9\u30bf\u30ea\u30f3\u30b0\u3092\u4f7f\u7528\u3057\u3066 WebSocket \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u30b9\u30b1\u30fc\u30eb\u3057\u3066\u304f\u3060\u3055\u3044\u3002NGINX<\/b>\u3001HAProxy<\/b>\u3001\u307e\u305f\u306f Kubernetes ingress controllers<\/b> \u306e\u3088\u3046\u306a\u30c4\u30fc\u30eb\u306f\u3001WebSocket \u63a5\u7d9a\u3092\u30b5\u30fc\u30d0\u30fc\u9593\u3067\u52b9\u679c\u7684\u306b\u5206\u6563\u3057\u3001\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3068\u53ef\u7528\u6027\u3092\u5411\u4e0a\u3055\u305b\u307e\u3059\u3002<\/p>\n \u4e88\u671f\u3057\u306a\u3044\u72b6\u6cc1\u3092\u7ba1\u7406\u3057\u3064\u3064\u63a5\u7d9a\u306e\u5b89\u5b9a\u6027\u3092\u7dad\u6301\u3059\u308b\u305f\u3081\u306b\u3001\u5805\u7262\u306a\u30a8\u30e9\u30fc\u51e6\u7406\u3092\u69cb\u7bc9\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u8a73\u7d30\u306a\u30a8\u30e9\u30fc\u30c7\u30fc\u30bf\u3092\u30ad\u30e3\u30d7\u30c1\u30e3\u3057\u3066\u30ed\u30b0\u306b\u6b8b\u3057\u3001\u5206\u6790\u3084\u4e8b\u524d\u5bfe\u7b56\u306b\u5f79\u7acb\u3066\u307e\u3059\u3002<\/p>\n \u9ad8\u3044\u63a5\u7d9a\u6570\u306b\u3088\u308b\u30aa\u30fc\u30d0\u30fc\u30ed\u30fc\u30c9\u3092\u9632\u3050\u305f\u3081\u306b\u3001\u30b5\u30fc\u30d0\u30fc\u30ea\u30bd\u30fc\u30b9\u3092\u7d99\u7d9a\u7684\u306b\u76e3\u8996\u30fb\u7ba1\u7406\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u30ec\u30fc\u30c8\u5236\u9650\u3001\u63a5\u7d9a\u30af\u30a9\u30fc\u30bf\u3001\u30e1\u30e2\u30ea\u7ba1\u7406\u6226\u7565\u3092\u9069\u7528\u3057\u3066\u3001\u9ad8\u8ca0\u8377\u6642\u3067\u3082\u4e00\u8cab\u3057\u305f\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u78ba\u4fdd\u3057\u307e\u3059\u3002<\/p>\n ping\/pong \u30d5\u30ec\u30fc\u30e0\u3084\u30cf\u30fc\u30c8\u30d3\u30fc\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u5b9f\u88c5\u3057\u3066\u975e\u30a2\u30af\u30c6\u30a3\u30d6\u306a\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3092\u691c\u51fa\u3057\u3001\u30ea\u30bd\u30fc\u30b9\u3092\u89e3\u653e\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u53e4\u304f\u306a\u3063\u305f\u308a\u30a2\u30a4\u30c9\u30eb\u72b6\u614b\u306e\u63a5\u7d9a\u304c\u5e2f\u57df\u3092\u6d6a\u8cbb\u3057\u305f\u308a\u30b7\u30b9\u30c6\u30e0\u6027\u80fd\u3092\u4f4e\u4e0b\u3055\u305b\u305f\u308a\u3059\u308b\u3053\u3068\u3092\u9632\u3052\u307e\u3059\u3002<\/p>\n WebSockets \u306f HTML \u30da\u30fc\u30b8\u306b\u30b7\u30fc\u30e0\u30ec\u30b9\u306b\u7d71\u5408\u3067\u304d\u3001\u52d5\u7684\u3067\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u306a\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u6210\u3067\u304d\u307e\u3059\u3002\u30d5\u30a9\u30fc\u30e0\u3001\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u3001\u30c1\u30e3\u30c3\u30c8\u30a6\u30a3\u30f3\u30c9\u30a6\u306e\u3088\u3046\u306a HTML \u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u306f WebSocket \u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u306b\u76f4\u63a5\u63a5\u7d9a\u3067\u304d\u3001\u30da\u30fc\u30b8\u306e\u30ea\u30ed\u30fc\u30c9\u3092\u5fc5\u8981\u3068\u305b\u305a\u306b\u30e9\u30a4\u30d6\u66f4\u65b0\u3068\u5373\u6642\u30d5\u30a3\u30fc\u30c9\u30d0\u30c3\u30af\u3092\u5b9f\u73fe\u3057\u307e\u3059\u3002<\/p>\n JSON\uff08JavaScript Object Notation\uff09\u306f\u3001WebSocket \u901a\u4fe1\u3067\u5e83\u304f\u4f7f\u7528\u3055\u308c\u308b\u8efd\u91cf\u306e\u30c7\u30fc\u30bf\u4ea4\u63db\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3067\u3059\u3002JSON \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u9001\u53d7\u4fe1\u3059\u308b\u3053\u3068\u3067\u3001\u958b\u767a\u8005\u306f\u69cb\u9020\u5316\u3055\u308c\u305f\u8907\u96d1\u306a\u30c7\u30fc\u30bf\u3092\u5bb9\u6613\u306b\u7ba1\u7406\u3067\u304d\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3068\u30b5\u30fc\u30d0\u30fc\u9593\u306e\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u3084\u308a\u53d6\u308a\u3092\u7c21\u7d20\u5316\u3057\u307e\u3059\u3002<\/p>\n WebSocket \u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u306f\u3001\u30b5\u30fc\u30d0\u30fc\u304c\u7740\u4fe1\u63a5\u7d9a\u3068\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u53d7\u3051\u4ed8\u3051\u308b\u5b9a\u7fa9\u6e08\u307f\u306e URL \u307e\u305f\u306f\u30d1\u30b9\u3067\u3059\u3002\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u306f\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3068\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u306e\u9593\u306e\u4e2d\u592e\u901a\u4fe1\u30d6\u30ea\u30c3\u30b8\u3068\u3057\u3066\u6a5f\u80fd\u3057\u3001\u52b9\u7387\u7684\u306a\u53cc\u65b9\u5411\u30e1\u30c3\u30bb\u30fc\u30b8\u4ea4\u63db\u3092\u4fc3\u9032\u3057\u307e\u3059\u3002<\/p>\n WebSockets \u306f TCP \u30c8\u30e9\u30f3\u30b9\u30dd\u30fc\u30c8\u5c64\u4e0a\u3067\u52d5\u4f5c\u3057\u3001\u30e1\u30c3\u30bb\u30fc\u30b8\u306e\u4fe1\u983c\u6027\u306e\u3042\u308b\u9806\u5e8f\u901a\u308a\u304b\u3064\u640d\u5931\u306e\u306a\u3044\u914d\u4fe1\u3092\u4fdd\u8a3c\u3057\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u53d6\u5f15\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u3084 IoT \u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u306e\u3088\u3046\u306b\u4e00\u8cab\u3057\u305f\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u66f4\u65b0\u304c\u5fc5\u8981\u306a\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u9069\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n WebSockets \u306f\u5f93\u6765\u306e HTTP \u30b5\u30fc\u30d3\u30b9\u3068\u540c\u3058\u30a6\u30a7\u30d6\u30b5\u30fc\u30d0\u30fc\u4e0a\u3067\u4e26\u884c\u3057\u3066\u5b9f\u884c\u3067\u304d\u3001\u958b\u767a\u8005\u306f\u9759\u7684\u30b3\u30f3\u30c6\u30f3\u30c4\uff08HTML\u3001CSS\u3001JS\uff09\u3068\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u901a\u4fe1\u306e\u4e21\u65b9\u3092\u7d71\u4e00\u3055\u308c\u305f\u74b0\u5883\u3067\u63d0\u4f9b\u3067\u304d\u307e\u3059\u3002\u3053\u306e\u30cf\u30a4\u30d6\u30ea\u30c3\u30c9\u69cb\u6210\u306f\u3001\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u5411\u4e0a\u3055\u305b\u3064\u3064\u30b7\u30fc\u30e0\u30ec\u30b9\u306a\u30e6\u30fc\u30b6\u30fc\u4f53\u9a13\u3092\u7dad\u6301\u3057\u307e\u3059\u3002<\/p>\n WebSockets \u306f \u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u3067\u30a4\u30f3\u30bf\u30e9\u30af\u30c6\u30a3\u30d6\u306a\u30a6\u30a7\u30d6\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3<\/b> \u3092\u69cb\u7bc9\u3059\u308b\u305f\u3081\u306e\u5f37\u529b\u3067\u4e0d\u53ef\u6b20\u306a\u6280\u8853\u3067\u3059\u3002\u5168\u4e8c\u91cd\u901a\u4fe1\u30c1\u30e3\u30cd\u30eb\u3092\u6709\u52b9\u306b\u3059\u308b\u3053\u3068\u3067\u3001\u5373\u6642\u306e\u30c7\u30fc\u30bf\u4ea4\u63db\u3001\u30ec\u30a4\u30c6\u30f3\u30b7\u306e\u4f4e\u6e1b\u3001\u5e2f\u57df\u5e45\u306e\u52b9\u7387\u7684\u5229\u7528\u3092\u53ef\u80fd\u306b\u3057\u3001\u3044\u305a\u308c\u3082\u30b7\u30fc\u30e0\u30ec\u30b9\u306a\u30e6\u30fc\u30b6\u30fc\u4f53\u9a13\u3092\u63d0\u4f9b\u3059\u308b\u4e0a\u3067\u91cd\u8981\u3067\u3059\u3002<\/p>\n WebSockets \u3092\u5b9f\u88c5\u3059\u308b\u306b\u306f\u3001\u4e92\u63db\u6027\u306e\u3042\u308b\u30b5\u30fc\u30d0\u30fc\u3092\u8a2d\u5b9a\u3057\u3001WebSocket API \u3092\u4f7f\u3063\u3066\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3092\u4f5c\u6210\u3057\u3001\u63a5\u7d9a\u7ba1\u7406\u3001\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u3001\u30b9\u30b1\u30fc\u30e9\u30d3\u30ea\u30c6\u30a3\u306b\u95a2\u3059\u308b\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u306b\u5f93\u3046\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u30c1\u30e3\u30c3\u30c8\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u3001\u30aa\u30f3\u30e9\u30a4\u30f3\u30b2\u30fc\u30e0\u3001\u307e\u305f\u306f\u30e9\u30a4\u30d6\u30c7\u30fc\u30bf\u66f4\u65b0\u30b5\u30fc\u30d3\u30b9\u3092\u958b\u767a\u3059\u308b\u5834\u5408\u3067\u3082\u3001WebSockets \u306f\u73fe\u4ee3\u306e\u30a6\u30a7\u30d6\u30b7\u30b9\u30c6\u30e0\u306b\u6c42\u3081\u3089\u308c\u308b\u5fdc\u7b54\u6027\u3068\u4fe1\u983c\u6027\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002<\/p>\n WebSockets \u3092\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u7d71\u5408\u3059\u308b\u3053\u3068\u3067\u3001\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3001\u30a4\u30f3\u30bf\u30e9\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\u3001\u304a\u3088\u3073\u904b\u7528\u52b9\u7387\u3092\u5927\u5e45\u306b\u5411\u4e0a\u3055\u305b\u3001\u30e6\u30fc\u30b6\u30fc\u3092\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u3067\u3064\u306a\u304e\u3001\u30a8\u30f3\u30b2\u30fc\u30b8\u30e1\u30f3\u30c8\u3092\u9ad8\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n \u8a73\u7d30\u306a\u60c5\u5831\u3084\u5b9f\u88c5\u306e\u8a73\u7d30\u306b\u3064\u3044\u3066\u306f\u3001WebSocket API \u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/b><\/a> \u304a\u3088\u3073 GitHub \u4e0a\u306e\u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u4f8b\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n
WebSockets\u306e\u5229\u70b9<\/h2>\n
\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u901a\u4fe1<\/h3>\n
\u30ec\u30a4\u30c6\u30f3\u30b7\u306e\u524a\u6e1b<\/h3>\n
\u5e2f\u57df\u5e45\u306e\u7bc0\u7d04<\/h3>\n
\u73fe\u4ee3\u30a2\u30d7\u30ea\u5411\u3051\u306e\u30b9\u30b1\u30fc\u30e9\u30d3\u30ea\u30c6\u30a3<\/h3>\n
WebSockets\u306e\u4e00\u822c\u7684\u306a\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9<\/h2>\n
\u30c1\u30e3\u30c3\u30c8\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3<\/h3>\n
\u30e9\u30a4\u30d6\u66f4\u65b0\u304a\u3088\u3073\u901a\u77e5<\/h3>\n
\u30aa\u30f3\u30e9\u30a4\u30f3\u30b2\u30fc\u30e0<\/h3>\n
\u30b3\u30e9\u30dc\u30ec\u30fc\u30b7\u30e7\u30f3\u30c4\u30fc\u30eb<\/h3>\n
\u91d1\u878d\u304a\u3088\u3073\u30c8\u30ec\u30fc\u30c7\u30a3\u30f3\u30b0\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3<\/h3>\n
WebSockets \u306e\u5b9f\u88c5<\/h2>\n
WebSocket \u30b5\u30fc\u30d0\u30fc\u306e\u8a2d\u5b9a<\/h3>\n
\n
WebSocket \u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306e\u4f5c\u6210<\/h3>\n
\/\/ Example: Simple WebSocket Client\r\nconst socket = new WebSocket(\"wss:\/\/example.com\/socket\");\r\n\r\n\/\/ When connection opens\r\nsocket.addEventListener(\"open\", () => {\r\n console.log(\"Connected to the WebSocket server\");\r\n socket.send(\"Hello Server!\");\r\n});\r\n\r\n\/\/ When a message is received\r\nsocket.addEventListener(\"message\", (event) => {\r\n console.log(\"Message from server:\", event.data);\r\n});\r\n\r\n\/\/ When connection closes\r\nsocket.addEventListener(\"close\", () => {\r\n console.log(\"WebSocket connection closed\");\r\n});\r\n<\/code><\/pre>\n\u30e1\u30c3\u30bb\u30fc\u30b8\u51e6\u7406<\/h3>\n
\/\/ Sending a message to the server\r\nsocket.send(JSON.stringify({ type: \"greeting\", message: \"Hello from client!\" }));\r\n\r\n\/\/ Receiving and handling messages from the server\r\nsocket.addEventListener(\"message\", (event) => {\r\n const data = JSON.parse(event.data);\r\n console.log(\"Message from server:\", data);\r\n});\r\n<\/code><\/pre>\nWebSocket API \u306e\u6a5f\u80fd<\/h2>\n
\u30b5\u30d6\u30d7\u30ed\u30c8\u30b3\u30eb\uff08Subprotocols\uff09<\/h3>\n
readyState<\/h3>\n
\n
\u8a8d\u8a3c<\/h3>\n
\u30d0\u30a4\u30ca\u30ea\u30c7\u30fc\u30bf<\/h3>\n
\u901a\u77e5<\/h3>\n
WebSockets \u3092\u4f7f\u3046\u305f\u3081\u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9<\/h2>\n
\u63a5\u7d9a\u7ba1\u7406<\/h3>\n
\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3<\/h3>\n
\u30b9\u30b1\u30fc\u30ea\u30f3\u30b0<\/h3>\n
\u30a8\u30e9\u30fc\u51e6\u7406<\/h3>\n
\u30ea\u30bd\u30fc\u30b9\u7ba1\u7406<\/h3>\n
\u30ad\u30fc\u30d7\u30a2\u30e9\u30a4\u30d6\u6a5f\u69cb<\/h3>\n
\u65e2\u5b58\u306e\u30a6\u30a7\u30d6\u6280\u8853\u3068\u306e\u7d71\u5408<\/h2>\n
HTML \u3068 WebSockets<\/h3>\n
JSON \u30c7\u30fc\u30bf<\/h3>\n
\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8<\/h3>\n
\u30c8\u30e9\u30f3\u30b9\u30dd\u30fc\u30c8\u5c64<\/h3>\n
\u30a6\u30a7\u30d6\u30b5\u30fc\u30d0\u30fc\u7d71\u5408<\/h3>\n
\u7d50\u8ad6<\/h3>\n