{"id":1280,"date":"2011-06-10T20:30:29","date_gmt":"2011-06-10T11:30:29","guid":{"rendered":"http:\/\/www.la-nouveau.mydns.jp\/wordpress\/?p=1280"},"modified":"2011-06-10T19:04:07","modified_gmt":"2011-06-10T10:04:07","slug":"javascript-%e3%80%8cnode-js%e3%81%a7websocket%e3%82%92%e8%a9%a6%e3%81%97%e3%81%a6%e3%81%bf%e3%81%9f%e3%82%93%e3%81%a0%e3%80%82%e3%80%8d%e3%81%ae%e3%81%be%e3%81%a8%e3%82%81%e3%80%82","status":"publish","type":"post","link":"https:\/\/www.la-nouveau.mydns.jp\/wordpress\/?p=1280","title":{"rendered":"[javascript] \u300cnode.js\u3067websocket\u3092\u8a66\u3057\u3066\u307f\u305f\u3093\u3060\u3002\u300d\u306e\u307e\u3068\u3081\u3002"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.la-nouveau.mydns.jp\/wordpress\/wp-photos\/2011\/06\/20110610.jpg\" alt=\"\" title=\"Socket.IO: the cross-browser WebSocket for realtime apps.\" width=\"450\" height=\"159\" class=\"alignnone size-full wp-image-1281\" srcset=\"https:\/\/www.la-nouveau.mydns.jp\/wordpress\/wp-photos\/2011\/06\/20110610.jpg 450w, https:\/\/www.la-nouveau.mydns.jp\/wordpress\/wp-photos\/2011\/06\/20110610-300x106.jpg 300w\" sizes=\"auto, (max-width: 450px) 100vw, 450px\" \/><\/p>\n<p><a href=\"http:\/\/socket.io\/\">Socket.IO: the cross-browser WebSocket for realtime apps.<\/a><\/p>\n<p>node.js\u3067\u6e80\u8db3\u3057\u3066\u3044\u305f\u3093\u3060\u3051\u3069\u3001websocket\u3082\u8a66\u3057\u3066\u307f\u305f\u3044\u3068\u3044\u3046\u6b32\u304c\u3042\u3063\u3066\u3001\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u307f\u305f\u3068\u304d\u306e\u30e1\u30e2\u3002<\/p>\n<p><strong>\u3053\u306e\u30da\u30fc\u30b8\u3092\u898b\u3066\u5b8c\u7d50\u3067\u304d\u308b\u3088\u3046\u306b\u3001\u3061\u3087\u3063\u3068\u5148\u65e5\u306e\u30d6\u30ed\u30b0\u3092\u5fa9\u5531\u3057\u307e\u3059\u3002<\/strong><\/p>\n<p>\u3010\u304b\u3093\u304d\u3087\u3046\u3011<br \/>\n\u3000OS\uff1afedora15<br \/>\n\u3000node.js\uff1av0.4.8<br \/>\n\u3000npm\uff1a1.0.10<br \/>\n\u3000socket.io\uff1a0.6.18 .\/node_modules\/socket.io<\/p>\n<p>\u3010\u3053\u3046\u3082\u304f\u3011<br \/>\n\u30001. git \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<br \/>\n\u30002. nvm\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<br \/>\n\u30003. node.js \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<br \/>\n\u30004. npm (Node Package Manager) \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<br \/>\n\u30005. socket.io \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<br \/>\n\u30006. node.js \u306e\u30b5\u30f3\u30d7\u30eb\uff08\u30c1\u30e3\u30c3\u30c8\u30a2\u30d7\u30ea\uff09\u3092\u8a66\u3057\u3066\u307f\u308b<br \/>\n\u30007. websocket\uff08socket.io\uff09 \u306e\u30b5\u30f3\u30d7\u30eb\uff08\u30c1\u30e3\u30c3\u30c8\u30a2\u30d7\u30ea\uff09\u3092\u8a66\u3057\u3066\u307f\u308b<\/p>\n<p>\u3067\u306f\u3001\u9577\u304f\u306a\u308a\u307e\u3059\u3002\u3002\u3002<\/p>\n<p>1. git \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/p>\n<blockquote><p>git\uff08\u304e\u3063\u3068\uff09\u306f\u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u306e\u5206\u6563\u578b\u30d0\u30fc\u30b8\u30e7\u30f3\u7ba1\u7406\u30b7\u30b9\u30c6\u30e0\u3067\u3059\u3002\u30d5\u30a1\u30a4\u30eb\u306e\u5909\u66f4\u5c65\u6b74\u3092\u7ba1\u7406\u3057\u307e\u3059\u3002<br \/>\nGPL\u30e9\u30a4\u30bb\u30f3\u30b9\u306e\u4e0b\u3067\u516c\u958b\u3055\u308c\u3066\u3044\u3066\u3001\u81ea\u5df1\u8cac\u4efb\u306e\u4e0b\u3067\u3001\u3060\u308c\u3082\u304c git \u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u203b&#8221;\u3058\u3063\u3068&#8221;\u3063\u3066\u4eca\u307e\u3067\u8aad\u3093\u3067\u305f\u3093\u3060\u306a\u3002\uff57 \u3061\u3085\u3046\u3044\u3061\u3085\u3046\u3044\u3002<\/p>\n<p><code># yum install git<\/code><\/p><\/blockquote>\n<p>2. nvm\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/p>\n<blockquote><p>nvm \u306f Node Version Manager \u306e\u3053\u3068\u3067\u3001Node.js \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3001\u30d0\u30fc\u30b8\u30e7\u30f3\u3054\u3068\u306e\u7ba1\u7406\u3001\u30b7\u30a7\u30eb\u306e\u74b0\u5883\u8a2d\u5b9a\u3092\u7ba1\u7406\u3067\u304d\u308b\u3002<br \/>\nnvm \u3092\u4f7f\u3046\u306b\u306f github \u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u304b\u3089 git clone\u3059\u308b\u3002<br \/>\n<code># git clone git:\/\/github.com\/creationix\/nvm.git ~\/.nvm<\/code>\n<\/p><\/blockquote>\n<p>3. node.js \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/p>\n<blockquote><p>node.js\u306b\u5fc5\u8981\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u306e\u3067<br \/>\n# yum install gcc-c++ openssl-devel<\/p>\n<p>github \u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u304b\u3089 git clone\u3059\u308b\u3002<br \/>\n<code># git clone git:\/\/github.com\/ry\/node.git<\/code><br \/>\n\u3082\u3057\u304f\u306f<br \/>\n<code># nvm install v0.4.8<\/code><\/p><\/blockquote>\n<p>4. npm (Node Package Manager) \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/p>\n<blockquote><p>npm \u3068\u3044\u3046\u306e\u306f\u3001node.js \u7528\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u3002\u4eca\u56de\u306f\u3001socket.IO \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u4f7f\u7528\u3002<br \/>\n<a href=\"https:\/\/github.com\/isaacs\/npm\">https:\/\/github.com\/isaacs\/npm<\/a> \u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306b\u5f93\u3063\u3066\u4f5c\u696d\u3002 <\/p>\n<p>\u3053\u3053\u3067\u30013\u306b\u3042\u308b\u3001nvm install v0.4.8\u3092\u884c\u3063\u305f\u3068\u304d\u306b\u540c\u6642\u306bnvm\u3082\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u307e\u3059\u3002<br \/>\n# nvm use v0.4.8<br \/>\n\u300cNode Package Manager\u3092\u4f7f\u7528\u3057\u307e\u3059\u3088\u3049\u300d\u3068\u5ba3\u8a00\u3057\u305f\u3042\u3068\u306b\u3001<br \/>\n<code># npm install socket.io<\/code>\n<\/p><\/blockquote>\n<p>\u3053\u308c\u3067\u3001\u3059\u3079\u3066\u74b0\u5883\u304c\u6574\u3046\u306f\u305a\u3067\u3059\u3002<\/p>\n<p>\u3067\u3001\u74b0\u5883\u3092\u6574\u3048\u305f\u5f8c\u306b\u8a66\u3057\u305f\u3044\u306e\u304c\u3001\u30b5\u30f3\u30d7\u30eb\u3002<\/p>\n<p>1)\u3000node.js\u306e\u30b5\u30f3\u30d7\u30eb<\/p>\n<p>node.js\u3092\u4f7f\u3063\u305f\u30c1\u30e3\u30c3\u30c8\u30a2\u30d7\u30ea\u30b5\u30f3\u30d7\u30eb<br \/>\n<a href=\"https:\/\/github.com\/ry\/node_chat\">ry-node_chat \u2013 GitHub<\/a><\/p>\n<p>\u30c7\u30e2\u306e\u30c1\u30e3\u30c3\u30c8\u30a2\u30d7\u30ea\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3002<br \/>\n<code># git clone git:\/\/github.com\/ry\/node_chat.git<\/code><br \/>\n\u203b\u81ea\u5206\u304c\u3044\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u4e0a\u306b\u30d5\u30a9\u30eb\u30c0\u304c\u4f5c\u6210\u3002<\/p>\n<p>\u3067\u3001<br \/>\n<code># cd node_chat<br \/>\n# node server.js<\/code><br \/>\n\u3092\u5b9f\u884c\u3002<br \/>\n\u30bf\u30fc\u30df\u30ca\u30eb\u306b\u306f\u3053\u306e\u3088\u3046\u306b\u8868\u793a\u3055\u308c\u308b\u3002<\/p>\n<blockquote><p>Server at http:\/\/127.0.0.1:8001\/<\/p><\/blockquote>\n<p>\u30a2\u30af\u30bb\u30b9\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<br \/>\n\u3067\u3001\u30cb\u30e4\u30cb\u30e4\u3057\u3066\u304f\u3060\u3055\u3044\u3002\uff57<\/p>\n<p>2)\u3000socket.io\u306e\u30b5\u30f3\u30d7\u30eb<\/p>\n<p>npm\u306b\u3088\u308a\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305fsocket.io\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u30b5\u30f3\u30d7\u30eb\u304c\u3042\u308b\u5834\u6240\u306f\u3001<br \/>\nnode_modules\/socket.io\/example\/\u306b\u7f6e\u3044\u3066\u3042\u308a\u307e\u3059\u3002<br \/>\nnode_modules\/socket.io\/example\/server.js\u3068\u3044\u3046\u30b5\u30fc\u30d0\u306e\u30b5\u30f3\u30d7\u30eb\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u5b9f\u969b\u306b\u5b9f\u884c\u3057\u3066\u307f\u308b\u3002<br \/>\n\uff08\u7406\u89e3\u3057\u305f\u3044\u3001\u77e5\u308a\u305f\u3044\u5834\u5408\u306f\u3001\u30bd\u30fc\u30b9\u306e\u4e2d\u8eab\u3092\u898b\u3066\u306d\u3002\u3068\u3044\u3046\u304b\u3001\u3053\u3053\u306e\u30d6\u30ed\u30b0\u3092\u898b\u3066\u3002\uff09<br \/>\n<a href=\"http:\/\/d.hatena.ne.jp\/yutakikuchi\/20110531\/1306798231\">Node.js\u3067WebSocket\u3092\u8a66\u3057\u3066\u307f\u308b &#8211; YutaKikuchi\u306eTechBlog<\/a><\/p>\n<p><code># node node_modules\/socket.io\/example\/server.js<\/code><\/p>\n<p>\u30b5\u30f3\u30d7\u30eb\u306eSocket\u30b5\u30fc\u30d0\u306e\u8d77\u52d5\u3059\u308b\u3068\u3001\u30bf\u30fc\u30df\u30ca\u30eb\u306b\u306f<\/p>\n<blockquote><p>10 Jun 18:43:07 &#8211; socket.io ready &#8211; accepting connections<\/p><\/blockquote>\n<p>\u3068\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u30a2\u30af\u30bb\u30b9\u3059\u308bURL\u306f<br \/>\nhttp:\/\/127.0.0.1:8080\/<br \/>\n\u3067\u3059\u3002<\/p>\n<p>\u8907\u6570\u306eWeb\u30d6\u30e9\u30a6\u30b6\u3067\u30a2\u30af\u30bb\u30b9\u3057\u3066\u30b3\u30e1\u30f3\u30c8\u3092\u6295\u7a3f\u3057\u3066\u307f\u308b\u3068WebSocket\u306e\u30c1\u30e3\u30c3\u30c8\u304c\u5229\u7528\u53ef\u80fd\u3002<br \/>\n\u3082\u3061\u308d\u3093\u3001\u3044\u308d\u3093\u306a\u30d6\u30e9\u30a6\u30b6\u304b\u3089\u30a2\u30af\u30bb\u30b9\u3057\u3066\u3072\u3068\u308a\u3067\u30c1\u30e3\u30c3\u30c8\u3057\u307e\u3057\u305f\u3002<\/p>\n<hr \/>\n<p>\u3010memo\u3011<br \/>\n<a href=\"http:\/\/nodejs.org\/\">node.js<\/a><br \/>\n<a href=\"http:\/\/nodejs.jp\/nodejs.org_ja\/api\/index.html\">Node.js Manual &#038; Documentation\uff08API\u30de\u30cb\u30e5\u30a2\u30eb\uff20\u65e5\u672c\u8a9e\uff09<\/a><br \/>\n<a href=\"http:\/\/dl.dropbox.com\/u\/219436\/node.js\/handson\/build\/html\/index.html\">node.js \u30cf\u30f3\u30ba\u30aa\u30f3\u8cc7\u6599 \u2014 node.js hands-on v1.0 documentation<\/a><br \/>\n<a href=\"http:\/\/www.atmarkit.co.jp\/fwcr\/index\/index_nodejs.html\">\u9023\u8f09\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u300cNode.js\u3067\u30b5\u30fc\u30d0\u30b5\u30a4\u30c9JavaScript\u958b\u767a\u5165\u9580\u300d &#8211; \uff20IT<\/a><br \/>\n<a href=\"http:\/\/libro99.appspot.com\/index3?id=446001\">\u3010libro\u3011 JavaScript\u306b\u3088\u308bHTML5\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u5165\u9580\/WebSocket\u306b\u3088\u308b\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\uff1d\u30b5\u30fc\u30d0\u30fc\u901a\u4fe1\/Ajax\u304b\u3089WebSocket\u3078\uff01<\/a><\/p>\n<hr \/>\n<p>\u3010\u53c2\u8003\u306b\u3055\u305b\u3066\u3044\u305f\u3060\u3044\u305f\u30d6\u30ed\u30b0\u3011<br \/>\n<a href=\"http:\/\/jmblog.jp\/archives\/709\">jmblog.jp \u2013 \u3055\u304f\u3089\u306e VPS \u306b node.js + npm + Socket.IO \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u624b\u9806<\/a><br \/>\n<a href=\"http:\/\/d.hatena.ne.jp\/yutakikuchi\/20110531\/1306798231\">Node.js\u3067WebSocket\u3092\u8a66\u3057\u3066\u307f\u308b &#8211; YutaKikuchi\u306eTechBlog<\/a><br \/>\n<a href=\"http:\/\/se-suganuma.blogspot.com\/2011\/05\/nodejs-socketioinstallwebsocketinstall.html\">SE\u596e\u95d8\u8a18: node.js, socket.io\u3092Install\u3057\u3066WebSocket\u3092\u8a66\u3059\uff08Install\u7de8\uff09<\/a><br \/>\n<a href=\"http:\/\/d.hatena.ne.jp\/replication\/20110427\/1303875126\">50\u884c\u304f\u3089\u3044\u3067\u4f5c\u308bnode.js + socket.io\u306e\u30b5\u30f3\u30d7\u30eb\u30d7\u30ed\u30b0\u30e9\u30e0 &#8211; \u5927\u4eba\u306b\u306a\u3063\u305f\u3089\u80ba\u547c\u5438<\/a><br \/>\n<a href=\"http:\/\/d.hatena.ne.jp\/mollifier\/20110221\/\">Node.js\u3068nvm\u3092\u521d\u3081\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3068\u304d\u306e\u30cf\u30de\u308a\u30dd\u30a4\u30f3\u30c8\u3068\u5bfe\u7b56 &#8211; ess sup<\/a><\/p>\n<p>\u6b21\u306f\u306a\u306b\u3057\u3088\u3046\u304b\u306a\u3041\uff1f<\/p>\n<p>From xxxYukihiroxxx<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Socket.IO: the cross-browser WebSocket for realtime apps. node.js\u3067\u6e80\u8db3\u3057\u3066\u3044\u305f\u3093\u3060\u3051\u3069\u3001websocket\u3082\u8a66\u3057\u3066\u307f\u305f\u3044\u3068\u3044\u3046\u6b32\u304c\u3042\u3063\u3066\u3001\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066 &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[1,5],"tags":[49,5,84],"class_list":["post-1280","post","type-post","status-publish","format-standard","hentry","category-memo","category-system","tag-javascript","tag-system","tag-yum"],"_links":{"self":[{"href":"https:\/\/www.la-nouveau.mydns.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1280","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.la-nouveau.mydns.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.la-nouveau.mydns.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.la-nouveau.mydns.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.la-nouveau.mydns.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1280"}],"version-history":[{"count":5,"href":"https:\/\/www.la-nouveau.mydns.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1280\/revisions"}],"predecessor-version":[{"id":1286,"href":"https:\/\/www.la-nouveau.mydns.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1280\/revisions\/1286"}],"wp:attachment":[{"href":"https:\/\/www.la-nouveau.mydns.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1280"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.la-nouveau.mydns.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1280"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.la-nouveau.mydns.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1280"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}