♣ Tech & Biz Salon/Tech

Windows에 node.js, socket.io 간단 설치

TasteGod 2014. 2. 10. 18:09

Installing node.js, socket.io on Windows7 64bit


Collaborative Whiteboard 해본다고... 처음으로 node.js, socket.io 세팅을 해보았습니다. 직접 해보는건 처음이네요.

예전에는 좀 더 절차가 필요했고, 최근에는 node.js 에 npm이 포함되어 있어 간소해진 상황이라고 합니다. ( node.js Current Version: v0.10.25 )

Install node.js

http://www.nodejs.org/

INSTALL 버튼 클릭해서 파일 다운로드후 실행

Install socket.io

C:\Program Files\nodejs>npm install socket.io
npm http GET https://registry.npmjs.org/socket.io
npm http 304 https://registry.npmjs.org/socket.io
npm http GET https://registry.npmjs.org/socket.io-client/0.9.16
npm http GET https://registry.npmjs.org/policyfile/0.0.4
npm http GET https://registry.npmjs.org/base64id/0.1.0
npm http GET https://registry.npmjs.org/redis/0.7.3
npm http 304 https://registry.npmjs.org/policyfile/0.0.4
.
.
npm http 304 https://registry.npmjs.org/nan
npm http 304 https://registry.npmjs.org/tinycolor

> ws@0.4.31 install C:\Program Files\nodejs\node_modules\socket.io\node_modules\socket.io-client\node_modules\ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)


C:\Program Files\nodejs\node_modules\socket.io\node_modules\socket.io-client\node_modules\ws>node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\nod
e-gyp\bin\node-gyp.js" rebuild
socket.io@0.9.16 node_modules\socket.io
├── base64id@0.1.0
├── policyfile@0.0.4
├── redis@0.7.3
└── socket.io-client@0.9.16 (xmlhttprequest@1.4.2, uglify-js@1.2.5, active-x-obfuscator@0.0.1, ws@0.4.31)

Start node.js

C:\Program Files\nodejs>node server.js
   info  - socket.io started
   debug - client authorized
   info  - handshake authorized U9JFpekNl80YUieC80y6
   debug - client authorized
   info  - handshake authorized W73ya-MQrKizl8T480y7
   debug - setting request GET /socket.io/1/websocket/W73ya-MQrKizl8T480y7
   debug - set heartbeat interval for client W73ya-MQrKizl8T480y7
   debug - client authorized for
   debug - websocket writing 1::
   debug - setting request GET /socket.io/1/websocket/U9JFpekNl80YUieC80y6
   debug - set heartbeat interval for client U9JFpekNl80YUieC80y6
   debug - client authorized for
   debug - websocket writing 1::

Shutdown node.js

Ctrl + C

끝^^

번외로...

Webstorm 써보니 좋네요. node.js 디버깅도 가능하다고 하고, 일단 몸에 와닿은건 html 만들고 브라우저로 보기 하면 해당 html이 file 프로토콜이 아니라 http 프로토콜로... 웹서버의 페이지로 열린다는 점이네요. javascript code 완성기능도 편하구요.

유료인 Webstorm이 무료인 Aptana 보다 많이 좋은거 같습니다. ( Aptana Studio 는 제대로 안써봤고 살짝만 써봐서 기억이 구체적으로 나지는 않지만요..)