Skip to content

Instantly share code, notes, and snippets.

@FLYBYME
Created April 2, 2013 00:49
Show Gist options
  • Save FLYBYME/5289082 to your computer and use it in GitHub Desktop.
Save FLYBYME/5289082 to your computer and use it in GitHub Desktop.
/**
* Module dependencies and config.
*/
var express = require('express')
var rTorrent = require('rtorrent')
var rt = new rTorrent({
host : 'localhost',
port : 80,
path : '/RPC2'
});
rt.details(function(err, torrents) {
console.log('your list of torrents', torrents);
})
var app = module.exports = express();
app.get('/', function(req, res) {
res.send('Hello World');
console.log('page render');
});
app.listen(3000);
console.log('Listening on port 3000');
@ParkerdeWaal
Copy link

nginx conf

location /RPC2 {
    include scgi_params;
    scgi_pass localhost:5000;
}

app.js

/**
 * Module dependencies and config.
 */

var express = require('express')
var rTorrent = require('rtorrent')

var rt = new rTorrent({
    host : 'localhost',
    port : 5000,
    path : '/RPC2'
});
rt.details(function(err, torrents) {
    console.log('your list of torrents', torrents);
})

var app = module.exports = express();
app.get('/', function(req, res) {
    res.send('Hello World');
    console.log('page render');
});

app.listen(3000);
console.log('Listening on port 3000');

@ParkerdeWaal
Copy link

localhost/RPC2 results in an error

$ xmlrpc localhost/RPC2 download_list
Failed.  Call failed.  HTTP response code is 404, not 200.  (XML-RPC fault code -504)

127.0.0.1/RPC2 results in an error

$ xmlrpc 127.0.0.1/RPC2 download_list
Failed.  Call failed.  HTTP response code is 404, not 200.  (XML-RPC fault code -504)

HOWEVER using the sites ip address or url works

$ xmlrpc domain@name/RPC2 download_list
Result:

Array of 41 items:
  Index  0 String: '404F0AD7BE87D73A4089413E8AEFC23A0363DF1C'

@FLYBYME
Copy link
Author

FLYBYME commented Apr 2, 2013

I have not used rtorrent with nginx.

If you can get to rtorrent with xmlrpc using the server ip/url then use it with you config.

something like.

var rTorrent = require('rtorrent')

var rt = new rTorrent({
    host : '192.168.1.20',
    port : 5000,
    path : '/RPC2'
});
rt.details(function(err, torrents, raw) {
    if(err) throw err;
    console.log('your list of torrents', torrents, raw);
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment