diff --git a/README.md b/README.md index 9e6feb1..8e16c1e 100644 --- a/README.md +++ b/README.md @@ -111,6 +111,7 @@ var Server = require('bittorrent-tracker').Server var server = new Server({ udp: true, // enable udp server? [default=true] http: true, // enable http server? [default=true] + ws: true, // enable websocket server? [default=false] filter: function (infoHash, params) { // black/whitelist for disallowing/allowing torrents [default=allow all] // this example only allows this one torrent @@ -122,9 +123,10 @@ var server = new Server({ }) }) -// Internal http and udp servers exposed as public properties. +// Internal http, udp, and websocket servers exposed as public properties. server.http server.udp +server.ws server.on('error', function (err) { // fatal server error! @@ -178,6 +180,7 @@ Easily start a tracker server: $ bittorrent-tracker http server listening on 8000 udp server listening on 8000 +ws server listening on 8000 ``` Lots of options: @@ -195,6 +198,7 @@ $ bittorrent-tracker --help --interval tell clients to announce on this interval (ms) --http enable http server [default: true] --udp enable udp server [default: true] + --ws enable ws server [default: false] -q, --quiet only show error output -s, --silent show no output -v, --version print the current version diff --git a/bin/cmd.js b/bin/cmd.js index 4c32e9c..9ab0ebf 100755 --- a/bin/cmd.js +++ b/bin/cmd.js @@ -18,12 +18,14 @@ var argv = minimist(process.argv.slice(2), { 'silent', 'trust-proxy', 'udp', - 'version' + 'version', + 'ws' ], default: { http: true, port: 8000, - udp: true + udp: true, + ws: false } }) @@ -46,6 +48,7 @@ if (argv.help) { --interval tell clients to announce on this interval (ms) --http enable http server [default: true] --udp enable udp server [default: true] + --ws enable websocket server [default: false] -q, --quiet only show error output -s, --silent show no output -v, --version print the current version @@ -63,7 +66,8 @@ var server = new Server({ http: argv.http, interval: argv.interval, trustProxy: argv['trust-proxy'], - udp: argv.udp + udp: argv.udp, + ws: argv.ws }) server.on('error', function (err) { @@ -92,4 +96,7 @@ server.listen(argv.port, function () { if (server.udp && !argv.quiet) { console.log('udp server listening on ' + server.udp.address().port) } + if (server.ws && !argv.quiet) { + console.log('ws server listening on ' + server.http.address().port) + } })