{"id":4438,"date":"2010-05-28T00:36:49","date_gmt":"2010-05-27T15:36:49","guid":{"rendered":"http:\/\/fukata.org\/?p=4438"},"modified":"2017-08-11T23:08:00","modified_gmt":"2017-08-11T23:08:00","slug":"install-pywebsocket-on-serversmanvps","status":"publish","type":"post","link":"https:\/\/blog.fukata.org\/archives\/4438\/","title":{"rendered":"ServersMan@VPS\u306bpywebsocket\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u307f\u305f"},"content":{"rendered":"
HTML5\u306b\u52a0\u308f\u308bwebsoket<\/a>\u3092\u4f7f\u7528\u3059\u308b\u3068\u4eca\u307e\u3067\u4ee5\u4e0a\u306b\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u6027\u306e\u9ad8\u3044\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u70ba\u500b\u4eba\u7684\u306b\u975e\u5e38\u306b\u6ce8\u76ee\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n \u30e1\u30a4\u30f3\u3067\u4f7f\u7528\u3057\u3066\u3044\u308b\u30d6\u30e9\u30a6\u30b6\u306eChrome\u306b\u306f\u65e2\u306bWebsocket\u304c\u5b9f\u88c5\u3055\u308c\u3066\u304a\u308a\u3001\u4f7f\u7528\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3060\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u7c21\u6613\u7684\u306a\u30c1\u30e3\u30c3\u30c8\u3067\u3082\u4f5c\u3063\u3066\u307f\u3088\u3046\u304b\u3068\u601d\u3044\u3001\u8272\u3005\u8abf\u3079\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n Jetty7\u3067WebSocket\u958b\u767a\uff1a\u30de\u30d4\u30aa\u30f3\u30e9\u30dc(Java)<\/a><\/p>\n \u30b5\u30fc\u30d0\u5074\u306e\u5b9f\u88c5\u306b\u3064\u3044\u3066\u307e\u3068\u3081\u3089\u308c\u3066\u3044\u307e\u3059\u3002\u4eca\u56de\u79c1\u304c\u9078\u629e\u3057\u305f\u306e\u306f\u3001pywebsocket<\/a>\u3068\u3044\u3046\u3082\u306e\u3067\u3059\u3002\u3053\u308c\u306f\u3001apache\u306e\u30e2\u30b8\u30e5\u30fc\u30eb\u3068\u3057\u3066\u63d0\u4f9b\u3055\u308cws\u30d7\u30ed\u30c8\u30b3\u30eb\u306e\u5834\u5408\u306fwebsocket\u30cf\u30f3\u30c9\u30e9\u306b\u51e6\u7406\u3092\u6d41\u3059\u3068\u3044\u3046\u3082\u306e\u3067\u3059\u3002\u30b9\u30bf\u30f3\u30c9\u30a2\u30ed\u30f3\u3067\u4f7f\u7528\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u308b\u3089\u3057\u3044\u306e\u3067\u3059\u304c\u3001\u4eca\u56de\u306fapache\u306e\u30e2\u30b8\u30e5\u30fc\u30eb\u3068\u3057\u3066\u4f7f\u7528\u3057\u307e\u3059\u3002pywebsocket\u3068\u3044\u3046\u540d\u524d\u304b\u3089websocket\u30cf\u30f3\u30c9\u30e9\u306f\u30d7\u30ed\u30b0\u30e9\u30e0\u8a00\u8a9ePython\u3067\u5b9f\u88c5\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u74b0\u5883\u306f\u3001ServersMan@VPS\u3067OS\u306fCentOs 5.4\u3067\u3059\u3002\u305d\u308c\u3067\u306f\u3001\u65e9\u901f\u624b\u9806\u306e\u65b9\u3092\u66f8\u3044\u3066\u3044\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n \u624b\u9806\u306f\u4ee5\u4e0b\u304b\u3089 \u76ee\u6b21<\/p> ServersMan@VPS\u4e0a\u306bapache\u306ewebsocket<\/p>\n mod_python\u3092\u30b3\u30f3\u30d1\u30a4\u30eb\u3059\u308b\u969b\u306bPython\u306e\u30bd\u30fc\u30b9\u304c\u5fc5\u8981\u306a\u70ba\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3002<\/p>\n \u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3001\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/strong><\/p>\n \n# wget ftp:\/\/mirror.switch.ch\/pool\/3\/mirror\/centos\/5.5\/os\/x86_64\/CentOS\/python-devel-2.4.3-27.el5.i386.rpm \u4e0a\u8a18\u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9URL\u306e\u63a5\u7d9a\u304c\u60aa\u3044\u5834\u5408\u306a\u3069\u306f\u3001\u4e0b\u8a18\u306e\u30b5\u30a4\u30c8\u304b\u3089\u4ed6\u306e\u30df\u30e9\u30fc\u30b5\u30a4\u30c8\u306eURL\u3092\u4f7f\u7528\u3059\u308b\u3002 Issue 42 – pywebsocket – Python2.4 Support (CentOS\/RHEL) – Project Hosting on Google Code<\/a><\/p>\n mod_python\u81ea\u4f53\u306fyum\u3067\u3082\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3053\u3068\u306f\u53ef\u80fd\u3060\u304c\u3001\u30d0\u30fc\u30b8\u30e7\u30f3\u304c3.2.x\u3067\u3042\u308a\u3001pywebsocket\u306fmod_python\u306e3.3\u3088\u308a\u4f4e\u3044\u30d0\u30fc\u30b8\u30e7\u30f3\u306f\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u306a\u3044\u70ba\u30bd\u30fc\u30b9\u304b\u3089\u30b3\u30f3\u30d1\u30a4\u30eb\u3059\u308b\u3002<\/p>\n \u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3001\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/strong><\/p>\n \n# wget https:\/\/ftp.kddilabs.jp\/infosystems\/apache\/httpd\/modpython\/mod_python-3.3.1.tgz python.conf\u306e\u4f5c\u6210<\/strong> \nLoadModule python_module modules\/mod_python.so svn\u306etrunk\u3092\u4f7f\u7528\u3057\u3066\u3082\u826f\u3044\u304c\u3001\u5b89\u5b9a\u3057\u3066\u3044\u308b\u53ef\u80fd\u6027\u304c\u9ad8\u3044\u30d0\u30fc\u30b8\u30e7\u30f3\u304c\u533a\u5207\u3089\u308c\u305f\u3082\u306e\u3092\u4eca\u56de\u306f\u4f7f\u7528\u3059\u308b\u3002\u4eca\u56de\u4f7f\u7528\u3057\u305fwebsocket\u306e\u672c\u5bb6\u30b5\u30a4\u30c8<\/a>\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3001\u30d0\u30fc\u30b8\u30e7\u30f30.5\u3088\u308a\u3082\u65b0\u3057\u3044\u3082\u306e\u304c\u30ea\u30ea\u30fc\u30b9\u3055\u308c\u3066\u3044\u308b\u5834\u5408\u306f\u3001\u3067\u304d\u308b\u9650\u308a\u305d\u3061\u3089\u3092\u4f7f\u3063\u305f\u65b9\u304c\u826f\u3044\u3002\u305f\u3060\u3057\u3001\u6b63\u5e38\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u308b\u304b\u306f\u4fdd\u8a3c\u3057\u306a\u3044\u3002<\/p>\n \u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3001\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/strong><\/p>\n \n# wget https:\/\/pywebsocket.googlecode.com\/files\/mod_pywebsocket-0.5.tar.gz \n# python setup.py install\n<\/p><\/blockquote>\n \u3092\u5b9f\u884c\u3057\u305f\u969b\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u305f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304c\u51fa\u529b\u3055\u308c\u308b\u306e\u3067\u30e1\u30e2\u3092\u53d6\u308b\u3002\u4eca\u56de\u306f\u4e0b\u8a18\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3002<\/p>\n \n\/usr\/lib\/python2.4\/site-packages\/\n<\/p><\/blockquote>\n python_mod_pywebsocket.conf\u306e\u4f5c\u6210<\/strong> \n<IfModule python_module> \u8a2d\u5b9a\u5024\u306e\u8aac\u660e\u306f\u4e0b\u8a18\u306e\u901a\u308a\u3002<\/p>\n PythonPath “sys.path+[‘\/usr\/lib\/python2.4\/site-packages\/’]”<\/p><\/blockquote>\n pywebsocket\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u30d1\u30b9\u3002<\/p>\n PythonOption mod_pywebsocket.handler_root \/var\/www\/html\/wsh<\/p><\/blockquote>\n websocket\u30cf\u30f3\u30c9\u30e9\u3092\u683c\u7d0d\u3055\u308c\u3066\u3044\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea<\/p>\n \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305fpywebsocket\u3092\u53cd\u6620\u3055\u305b\u308b\u70ba\u306bapache\u3092\u518d\u8d77\u52d5\u3059\u308b\u3002<\/p>\n \n# \/etc\/init.d\/httpd restart\n<\/p><\/blockquote>\n \u4e0a\u8a18\u3067\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305fpywebsocket\u306b\u306f\u30b5\u30f3\u30d7\u30eb\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u305d\u308c\u304c\u6b63\u5e38\u306b\u52d5\u4f5c\u3059\u308b\u304b\u52d5\u4f5c\u78ba\u8a8d\u3092\u884c\u3046\u3002<\/p>\n \u30b5\u30f3\u30d7\u30eb\u306e\u914d\u7f6e<\/strong><\/p>\n \n# cd pywebsocket-0.5\/src\/example \u52d5\u4f5c\u78ba\u8a8d<\/strong><\/p>\n \n# python echo_client.py -s localhost -r \/echo PythonOption mod_pywebsocket.handler_root \/var\/www\/html\/wsh<\/p><\/blockquote>\n \u4e0a\u8a18\u3067\u8a2d\u5b9a\u3057\u305fmod_pywebsocket.handler_root\u304b\u3089\u4e0b\u8a18\u306e\u3088\u3046\u306a\u547d\u540d\u898f\u5247\u3067\u30cf\u30f3\u30c9\u30e9\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<\/p>\n \n[{\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u30d1\u30b9}]{\u30ea\u30bd\u30fc\u30b9\u540d}_wsh.py\n<\/p><\/blockquote>\n \u30b5\u30f3\u30d7\u30eb<\/strong> \u30a2\u30af\u30bb\u30b9URI\uff1aws:\/\/localhost:80\/chat\/echo HTML5\u306b\u52a0\u308f\u308bwebsoket\u3092\u4f7f\u7528\u3059\u308b\u3068\u4eca\u307e\u3067\u4ee5\u4e0a\u306b\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u6027\u306e\u9ad8\u3044\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u70ba\u500b\u4eba\u7684\u306b\u975e\u5e38\u306b\u6ce8\u76ee\u3057\u3066\u3044\u307e\u3059\u3002 \u30e1\u30a4\u30f3\u3067\u4f7f\u7528\u3057\u3066\u3044\u308b\u30d6\u30e9\u30a6\u30b6\u306eChrome\u306b\u306f\u65e2\u306b … \u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":2,"featured_media":9223372036854775807,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1980],"tags":[750,476,775,738,776],"_links":{"self":[{"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/posts\/4438"}],"collection":[{"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/comments?post=4438"}],"version-history":[{"count":0,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/posts\/4438\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/media\/9223372036854775807"}],"wp:attachment":[{"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/media?parent=4438"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/categories?post=4438"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/tags?post=4438"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}
\n<\/p>\n\u6982\u8981<\/span><\/h2>\n
\u524d\u63d0\u6761\u4ef6<\/span><\/h2>\n
\n
\u4f5c\u696d\u624b\u9806<\/span><\/h2>\n
python-devel\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/span><\/h3>\n
\n# rpm -ivh python-devel-2.4.3-27.el5.i386.rpm\n<\/p><\/blockquote>\n
\nRPM Search CentOS\u00a05 python-devel-2.4.3-27.el5.i386.rpm<\/p>\nmod_python\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/span><\/h3>\n
\n# tar zxf mod_python-3.3.1.tgz
\n# cd mod_python-3.3.1
\n# .\/configure –with-apxs=\/usr\/sbin\/apxs –with-python=\/usr\/bin\/python
\n# make
\n# make install\n<\/p><\/blockquote>\n
\n\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9\uff1a\/etc\/httpd\/conf.d\/python.conf
\n\u30d5\u30a1\u30a4\u30eb\u5185\u5bb9<\/p>\n
\nAddHandler mod_python .py\n<\/p><\/blockquote>\npywebsocket\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/span><\/h3>\n
\n# tar zxf mod_pywebsocket-0.5.tar.gz
\n# cd pywebsocket-0.5\/src
\n# python setup.py build
\n# python setup.py install\n<\/p><\/blockquote>\n
\n\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9\uff1a\/etc\/httpd\/conf.d\/python_mod_pywebsocket.conf
\n\u30d5\u30a1\u30a4\u30eb\u5185\u5bb9<\/p>\n
\n PythonPath “sys.path+[‘\/usr\/lib\/python2.4\/site-packages\/’]”
\n PythonOption mod_pywebsocket.handler_root \/var\/www\/html\/wsh
\n PythonHeaderParserHandler mod_pywebsocket.headerparserhandler
\n<\/IfModule>\n<\/p><\/blockquote>\npywebsocket\u306e\u53cd\u6620<\/span><\/h3>\n
\u30b5\u30f3\u30d7\u30eb\u306e\u914d\u7f6e\u30fb\u52d5\u4f5c\u78ba\u8a8d<\/span><\/h3>\n
\n# cp echo_wsh.py \/var\/www\/html\/wsh\/\n<\/p><\/blockquote>\n
\nSend: Hello
\nRecv: Hello
\nSend: \u65e5\u672c
\nRecv: \u65e5\u672c
\nClosing handshake
\n# python echo_client.py -s localhost -r \/echo -m ‘hoge’,’foo’
\nSend: hoge
\nRecv: hoge
\nSend: foo
\nRecv: foo
\nClosing handshake\n<\/p><\/blockquote>\n\u88dc\u8db3<\/span><\/h2>\n
websocket\u30cf\u30f3\u30c9\u30e9\u30d5\u30a1\u30a4\u30eb\u306e\u547d\u540d\u898f\u5247<\/span><\/h3>\n
\n\u30a2\u30af\u30bb\u30b9URI\uff1aws:\/\/localhost:80\/echo
\n\u5b9f\u884c\u3055\u308c\u308b\u30cf\u30f3\u30c9\u30e9\u30d1\u30b9\uff1a\/var\/www\/html\/wsh\/echo_wsh.py<\/p>\n
\n\u5b9f\u884c\u3055\u308c\u308b\u30cf\u30f3\u30c9\u30e9\u30d1\u30b9\uff1a\/var\/www\/html\/wsh\/chat\/echo_wsh.py<\/p>\n","protected":false},"excerpt":{"rendered":"