blob: 3b8dc266753671b3de022914447b62f22d08d69f [file] [log] [blame] [view]
Wentao Shangaf25c6b2012-12-03 00:09:30 -08001wsproxy
2=======
Jeff Thompson287a3182012-11-11 18:12:20 -08003
Wentao Shangc05dc532012-11-19 12:00:33 -08004WebSocket proxy server between NDN javascript stack and ccnd.
Jeff Thompson287a3182012-11-11 18:12:20 -08005
Wentao Shangc05dc532012-11-19 12:00:33 -08006This 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 Thompson287a3182012-11-11 18:12:20 -08007
Wentao Shangc05dc532012-11-19 12:00:33 -08008Installation guide:
9
101) node.js: go to http://nodejs.org/ to download and install node.js;
Wentao Shangaf25c6b2012-12-03 00:09:30 -080011
Wentao Shangc05dc532012-11-19 12:00:33 -0800122) ws package: use command 'npm install ws' or go to https://github.com/einaros/ws for more information;
Wentao Shangaf25c6b2012-12-03 00:09:30 -080013
Wentao Shangc05dc532012-11-19 12:00:33 -0800143) node-getopt package: use command 'npm install node-getopt' or go to https://npmjs.org/package/node-getopt for more information.
15
16
17To run the proxy, simply use the command 'node wsproxy-tcp.js' or 'node wsproxy-udp.js'.
Wentao Shangaf25c6b2012-12-03 00:09:30 -080018
Wentao Shangc05dc532012-11-19 12:00:33 -080019To specify remote ccnd router's hostname or ip address, use option '-c x.x.x.x'. Default is 'localhost'.
Wentao Shangaf25c6b2012-12-03 00:09:30 -080020
Wentao Shang286ac922012-11-19 13:33:13 -080021To specify the port number on which the proxy will listen, use option '-p xxxx'. Default is 9696.
Wentao Shangaf25c6b2012-12-03 00:09:30 -080022
Wentao Shangc05dc532012-11-19 12:00:33 -080023To specify maximum number of concurrent clients, use option '-m N'. Default is 40.
Wentao Shangaf25c6b2012-12-03 00:09:30 -080024
Wentao Shangc05dc532012-11-19 12:00:33 -080025To 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.
26
27Example: to setup UDP connection to ccnd router 192.168.1.51 with max client number 50 and log level 2, use the command:
28
29node wsproxy-udp.js -c 192.168.1.51 -m 50 -L 2
Jeff Thompson287a3182012-11-11 18:12:20 -080030
31Acknowledgement: this code is extended from Junxiao's WebSocket proxy implementation (https://gist.github.com/3835425).