lib/parser.js
function RpcParser(opts) {
    assert.optionalObject(opts, 'options');

    stream.Writable.call(this, opts);

    this._buffer = null;
    this.rpc_table = {}; // TODO - use this when fragments are supported

    this._rpc_parser = true; // MDB flag
}
function RpcParser(opts) {
    assert.optionalObject(opts, 'options');

    stream.Writable.call(this, opts);

    this._buffer = null;
    this.rpc_table = {}; // TODO - use this when fragments are supported

    this._rpc_parser = true; // MDB flag
}
/--- API 
RpcParser

A Node.js Writable stream for parsing RPC messages; note this assumes that
messages are being fed in from a TCP stream only.

This parser runs as a state machine, and parses as much as it can per
instance of (node) `write`.  When a full RpcCall/RpcReply is parsed, then the
message is emitted. Note each message must be an instance of stream.Writable
as this parser will continue to write data to each message until it sees
"end" (which is an RPC semantic indicating "last fragment"). At that point
the message is dropped from the internal table, and this moves on.

Because this parser emits high-level JS objects, this is not an instance of
stream.Readable.  Instead consumers must listen for 'message'; each of those
messages is an instance of stream.Readable (but may not have data associated
with it!).

For more information on RPC: http://tools.ietf.org/html/rfc1057