Jeff Thompson | 287a318 | 2012-11-11 18:12:20 -0800 | [diff] [blame] | 1 | ws-ndn-js |
| 2 | ========= |
| 3 | |
Wentao Shang | c05dc53 | 2012-11-19 12:00:33 -0800 | [diff] [blame] | 4 | WebSocket proxy server between NDN javascript stack and ccnd. |
Jeff Thompson | 287a318 | 2012-11-11 18:12:20 -0800 | [diff] [blame] | 5 | |
Wentao Shang | c05dc53 | 2012-11-19 12:00:33 -0800 | [diff] [blame] | 6 | This proxy runs on top of 'node.js'. 'ws' and 'node-getopt' packages are required. It listens for WebSocket connection request on port number 9696. Once it receives a incoming connection, it issues a TCP connection to the specified 'ccnd' router (port number 9695). It then translates packet frames from WebSocket to pure TCP byte streams and vice versa. |
Jeff Thompson | 287a318 | 2012-11-11 18:12:20 -0800 | [diff] [blame] | 7 | |
Wentao Shang | c05dc53 | 2012-11-19 12:00:33 -0800 | [diff] [blame] | 8 | Installation guide: |
| 9 | |
| 10 | 1) node.js: go to http://nodejs.org/ to download and install node.js; |
| 11 | 2) ws package: use command 'npm install ws' or go to https://github.com/einaros/ws for more information; |
| 12 | 3) node-getopt package: use command 'npm install node-getopt' or go to https://npmjs.org/package/node-getopt for more information. |
| 13 | |
| 14 | |
| 15 | To run the proxy, simply use the command 'node wsproxy-tcp.js' or 'node wsproxy-udp.js'. |
| 16 | To specify remote ccnd router's hostname or ip address, use option '-c x.x.x.x'. Default is 'localhost'. |
Wentao Shang | 286ac92 | 2012-11-19 13:33:13 -0800 | [diff] [blame^] | 17 | To specify the port number on which the proxy will listen, use option '-p xxxx'. Default is 9696. |
Wentao Shang | c05dc53 | 2012-11-19 12:00:33 -0800 | [diff] [blame] | 18 | To specify maximum number of concurrent clients, use option '-m N'. Default is 40. |
| 19 | To specify the level of log info display, use option '-L x'. x=0 means no output; x=1 will log connection startup and close; x=2 will log contents of all messages that flow across the proxy. Default is 1. |
| 20 | |
| 21 | Example: to setup UDP connection to ccnd router 192.168.1.51 with max client number 50 and log level 2, use the command: |
| 22 | |
| 23 | node wsproxy-udp.js -c 192.168.1.51 -m 50 -L 2 |
Jeff Thompson | 287a318 | 2012-11-11 18:12:20 -0800 | [diff] [blame] | 24 | |
| 25 | Acknowledgement: this code is extended from Junxiao's WebSocket proxy implementation (https://gist.github.com/3835425). |