{"id":952,"date":"2010-06-17T01:26:50","date_gmt":"2010-06-16T16:26:50","guid":{"rendered":"http:\/\/ecpplus.net\/weblog\/?p=952"},"modified":"2020-06-26T01:56:09","modified_gmt":"2020-06-25T16:56:09","slug":"websocket-%e3%81%a7%e3%83%aa%e3%82%a2%e3%83%ab%e3%82%bf%e3%82%a4%e3%83%a0%e3%81%8a%e7%b5%b5%e3%81%8b%e3%81%8d%e3%83%81%e3%83%a3%e3%83%83%e3%83%88%e4%bd%9c%e3%81%a3%e3%81%9f","status":"publish","type":"post","link":"https:\/\/ecpplus.net\/weblog\/websocket-%e3%81%a7%e3%83%aa%e3%82%a2%e3%83%ab%e3%82%bf%e3%82%a4%e3%83%a0%e3%81%8a%e7%b5%b5%e3%81%8b%e3%81%8d%e3%83%81%e3%83%a3%e3%83%83%e3%83%88%e4%bd%9c%e3%81%a3%e3%81%9f\/","title":{"rendered":"WebSocket \u3067\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u304a\u7d75\u304b\u304d\u30c1\u30e3\u30c3\u30c8\u4f5c\u3063\u305f"},"content":{"rendered":"<p>\u3000WebSocket\u3092\u4f7f\u3063\u3066\u3001<a href=\"http:\/\/twitter.com\/projecthl2\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"broken_link\">@projecthl2<\/a>\u5148\u751f\u3068\u3044\u3063\u3057\u3087\u306b\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u9023\u52d5\u304a\u7d75\u304b\u304d\u30c1\u30e3\u30c3\u30c8\u3092\u4f5c\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p><a href=\"http:\/\/paint.ecpplus.net\/\" target=\"_blank\" rel=\"noopener noreferrer\">\u304a\u3048\u304b\u304d\u3061\u3083\u3063\u3068\u2665<\/a><\/p>\n<p>\u3000WebSocket \u901f\u3044\u3067\u3059\uff01\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u3067\u540c\u671f\u3057\u3066\u3044\u308b\u306e\u3067\u3001\u6570\u4eba\u3067\u3084\u308b\u3068\u3001\u6bce\u79d2\u30b5\u30fc\u30d0\u306850\u56de\u3068\u304b\u3084\u308a\u3068\u308a\u3057\u3066\u308b\u306e\u3060\u3051\u3069 (1\u56de\u306e\u901a\u4fe1\u306f\u304a\u305d\u3089\u304f100bytes\u304f\u3089\u3044)\u3001\u30b5\u30fc\u30d0\u5074\u306f\u307b\u3068\u3093\u3069CPU\u98df\u3063\u3066\u306a\u3044\u307f\u305f\u3044\u3067\u3059\u306d\u3002\u3059\u3054\u3043\u3002\u3082\u3057 AJAX \u3068\u304b\u4f7f\u3046\u3068\u3059\u308b\u3068\u3001\u6bce\u79d250\u56de\u3068\u304b\u30b5\u30fc\u30d0\u306b\u30ea\u30af\u30a8\u30b9\u30c8\u98db\u3070\u305d\u3046\u3068\u304b\u7d76\u5bfe\u8003\u3048\u306a\u3044\u3088\u30022\u7a93\u958b\u3044\u3066\u307f\u308b\u3068\u3001\u9045\u5ef6\u306f\u307b\u307c0\u3067\u901a\u4fe1\u3067\u304d\u3066\u308b\u3053\u3068\u304c\u5206\u304b\u308a\u307e\u3059\u3002<\/p>\n<p>\u3000WebSocket \u306f\u3001\u3084\u3063\u3066\u307f\u305f\u3068\u3053\u308d\u3067\u306f\u6587\u5b57\u5217\u3057\u304b\u9001\u308c\u306a\u3055\u305d\u3046\u306a\u306e\u3067\u3001\u4eca\u307e\u3067AJAX\u3067JSON\u6271\u3063\u3066\u305f\u3088\u3046\u306a\u3082\u306e\u306f\u6587\u5b57\u5217\u306b\u3057\u3066\u9001\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n<pre lang=\"javascript\">JSON.stringfy({x:100, y:100})<\/pre>\n<p>\u307f\u305f\u3044\u306b\u3057\u3066\u30b5\u30fc\u30d0\u306b\u9001\u3063\u3066\u3001\u30b5\u30fc\u30d0\u304b\u3089JSON\u3092\u6587\u5b57\u5217\u306b\u3057\u305f\u3082\u306e\u3092\u9001\u3063\u3066<\/p>\n<pre lang=\"javascript\">JSON.parse(event.data)<\/pre>\n<p>\u7684\u306a\u611f\u3058\u306bJSON\u3092\u5f97\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u3000\u304a\u7d75\u304b\u304d\u90e8\u5206\u3068\u3001\u30c1\u30e3\u30c3\u30c8\u90e8\u5206\u3067WebSocket\u3092\u4f7f\u3063\u3066\u3044\u307e\u3059\u3002\u30b5\u30fc\u30d0\u5074\u306eWebSocket\u90e8\u5206\u306f <a href=\"http:\/\/github.com\/igrigorik\/em-websocket\" target=\"_blank\" rel=\"noopener noreferrer\">em-websocket<\/a> \u3092\u4f7f\u3044\u307e\u3057\u305f\u3002EventMachine \u3092\u4f7f\u3063\u305f WebSocket \u5b9f\u88c5\u307f\u305f\u3044\u3067\u3059\u3002WebSocket \u306f\u30b7\u30f3\u30d7\u30eb\u3067\u3057\u305f\u3002EventMachine \u306e\u4f7f\u3044\u65b9\u3092\u8abf\u3079\u308b\u306e\u306b\u6642\u9593\u304c\u304b\u304b\u3063\u305f\u3002\u3002<\/p>\n<p>\u3000\u304a\u7d75\u304b\u304d\u90e8\u5206\u306f\u3001canvas \u3092\u4f7f\u3063\u3066\u3044\u307e\u3059\u3002\u30d5\u30a1\u30a4\u30eb\u3092\u30ed\u30fc\u30c9\u306e\u90e8\u5206\u306f XMLHttpRequest Level2 \u3092\u4f7f\u3063\u3066\u3044\u307e\u3059\u3002\u6700\u521d\u306f\u3001FileAPI \u3092\u4f7f\u3063\u3066\u5b9f\u88c5\u3059\u308c\u3070\u30b5\u30fc\u30d0\u7d4c\u7531\u305b\u305a\u306b\u30d5\u30a1\u30a4\u30eb\u30ed\u30fc\u30c9\u3067\u304d\u3066\uff73\uff8f\uff70!! \u3068\u601d\u3063\u305f\u3051\u3069\u3001\u307e\u3060 Firefox \u3067\u3057\u304b\u4f7f\u3048\u306a\u3044\u307f\u305f\u3044\u306a\u306e\u3067\u3001\u3042\u304d\u3089\u3081\u307e\u3057\u305f\u3002Twitter\u306b\u6295\u7a3f\u3063\u3066\u3044\u3046\u90e8\u5206\u306f\u3001canvas \u304b\u3089 toDataURL() \u3067 canvas \u306b\u63cf\u304b\u308c\u305f\u30c7\u30fc\u30bf\u304c Base64\u30a8\u30f3\u30b3\u30fc\u30c9\u3055\u308c\u305f\u3082\u306e\u3092\u53d6\u3063\u3066\u3001\u305d\u3044\u3064\u3092\u30b5\u30fc\u30d0\u5074\u306b\u9001\u3063\u3066\u4fdd\u5b58\u3057\u3066\u3044\u307e\u3059\u3002\u4eca\u307e\u3067\u306e XMLHttpRequest \u3063\u3066\u30d5\u30a1\u30a4\u30eb\u3092\u30b5\u30fc\u30d0\u306b\u9001\u4fe1\u51fa\u6765\u306a\u304b\u3063\u305f\u306e\u3067\u3001\u7121\u7406\u77e2\u7406 iframe \u4f7f\u3063\u305f\u308a\u3068\u304b\u9811\u5f35\u3063\u3066\u3044\u305f\u3051\u3069\u3001\u30d5\u30a1\u30a4\u30eb\u304c\u9001\u308c\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3059\u3054\u3044\u4fbf\u5229\u305d\u3046\u3067\u3059\u3002\u4f7f\u3044\u65b9\u306f\u4eca\u307e\u3067\u306e\u3082\u306e\u3068\u5927\u3057\u3066\u5909\u308f\u3089\u306a\u3044\u307f\u305f\u3044\u3067\u3059\u3057\u3002<\/p>\n<p>\u3000<br \/>\n\u3000HTML\u3092\u751f\u6210\u3059\u308b\u90e8\u5206\u306f sinatra \u3061\u3083\u3093\u3067\u3059\u3002sinatra \u3061\u3083\u3093\u53ef\u611b\u3044\u3088\u3002\u30bb\u30f3\u30b9\u3044\u3044\u3068\u601d\u3046\u3002<\/p>\n<p>\u30002\u65e5\u3067\u4f5c\u3089\u308c\u305f\u3082\u306e\u306a\u306e\u3067\u3001\u4f8b\u5916\u51e6\u7406\u3068\u304b\u3042\u3093\u307e\u308a\u3057\u3066\u306a\u3043\u3002\u3002\u3067\u30822\u65e5\u3067\u3053\u306e\u304f\u3089\u3044\u306e\u3082\u306e\u51fa\u6765\u308b\u3068\u306f\u3001\u9ad8\u6a5f\u80fd\u306aHTML\u3067\u3059\u306d\u30fc<\/p>\n<p>\u3000\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092 github \u3067\u516c\u958b\u3057\u3066\u3044\u307e\u3059\u3002 -> <a href=\"https:\/\/github.com\/ecpplus\/websocket_chat\" target=\"_blank\" rel=\"noopener noreferrer\">ecpplus \/ websocket_chat<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3000WebSocket\u3092\u4f7f\u3063\u3066\u3001@projecthl2\u5148\u751f\u3068\u3044\u3063\u3057\u3087\u306b\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u9023\u52d5\u304a\u7d75\u304b\u304d\u30c1\u30e3\u30c3\u30c8\u3092\u4f5c\u3063\u3066\u307f\u307e\u3057\u305f\u3002 \u304a\u3048\u304b\u304d\u3061\u3083\u3063\u3068\u2665 \u3000WebSocket \u901f\u3044\u3067\u3059\uff01\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u3067\u540c\u671f\u3057\u3066\u3044\u308b\u306e\u3067\u3001\u6570\u4eba\u3067\u3084\u308b\u3068\u3001\u6bce [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2872,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[43],"tags":[25,8,24,23],"class_list":["post-952","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-development","tag-html5","tag-ruby","tag-sinatra","tag-websocket"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/ecpplus.net\/weblog\/wp-json\/wp\/v2\/posts\/952","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ecpplus.net\/weblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ecpplus.net\/weblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ecpplus.net\/weblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ecpplus.net\/weblog\/wp-json\/wp\/v2\/comments?post=952"}],"version-history":[{"count":2,"href":"https:\/\/ecpplus.net\/weblog\/wp-json\/wp\/v2\/posts\/952\/revisions"}],"predecessor-version":[{"id":2873,"href":"https:\/\/ecpplus.net\/weblog\/wp-json\/wp\/v2\/posts\/952\/revisions\/2873"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ecpplus.net\/weblog\/wp-json\/wp\/v2\/media\/2872"}],"wp:attachment":[{"href":"https:\/\/ecpplus.net\/weblog\/wp-json\/wp\/v2\/media?parent=952"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ecpplus.net\/weblog\/wp-json\/wp\/v2\/categories?post=952"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ecpplus.net\/weblog\/wp-json\/wp\/v2\/tags?post=952"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}