Perform XML-RPC using any kind of stream!

npm install xmlrpc-stream
6 downloads in the last month


Perform XML-RPC using any kind of stream!


xmlrpc-stream implements the XML and RPC bits of XML-RPC without the implied transport portion. Any duplex stream can be used as a transport.


Available via npm:

$ npm install xmlrpc-stream

Or via git:

$ git clone git://github.com/deoxxa/xmlrpc-stream.git node_modules/xmlrpc-stream



Creates a new RPC object. Expects a stream factory function as an argument. This factory function will be called whenever a transport is required (read: every single time you call a remote method).

new RPC(fn);
var rpc = new RPC(function() {
  return net.connect(3000, "");


Calls a remote method by name, optionally with some parameters, then calls your callback with the result (or an error! woo!).

rpc.call(method, [arg1, [arg2, [argN ...]]], cb);
rpc.call("system.listMethods", function(err, res) {
  console.log(err, res);

// OR

rpc.call("system.methodSignature", "system.listMethods", function(err, res) {
  console.log(err, res);


  • method - a string, naming the remote method to call.
  • argN - the parameters for the remote method.
  • cb - a callback to be called when the response comes in.


Also see example.js. This uses scgi-stream as well, but you could just as easily replace that with net.connect or something if you had a remote server that supported XML-RPC over regular TCP sockets.

var scgi = require("scgi-stream"),
    RPC = require("xmlrpc-stream");

var rpc = new RPC(function() {
  return scgi.duplex({
    host: "",
    port: 17199,
    path: "/",

rpc.call("d.multicall", "default", "d.get_creation_date=", "d.get_bytes_done=", "d.get_directory=", "d.get_down_rate=", "d.get_up_rate=", "d.get_down_total=", "d.get_up_total=", function(err, res) {
  console.log(err, res);


3-clause BSD. A copy is included with the source.


npm loves you