{"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":"

\"WebSocket\u3068\u306f\u4f55\u304b\uff1f<\/p>\n

WebSocket\u3068\u306f\uff1f<\/h2>\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>\n

WebSockets\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