iris-rpc.js
function Router(options) {
    var self = this;

    self.frontend = new Server({
        port : options.port, 
        auth : options.auth || options.secret,
        certificates : options.certificates,
        routing : true
    })


    // connect to relay destination
    if(options.client) {
        self.backend = new Client({
            address: options.client.address,
            auth: options.client.auth || options.client.secret || options.auth || options.secret,
            certificates: options.certificates || options.client.certificates,
            //node: options.node,
            designation: 'router',
            routes : self.frontend.streams
        })
    }
    else
    if(options.server) {
        self.backend = new Server({
            port : options.server.port, 
            auth : options.server.auth || options.server.secret || options.auth || options.secret,
            certificates : options.certificates || options.server.certificates,
            routes : self.frontend.streams
        })
    }
    else
        throw new Error("iris-rpc::Router() requires client or server")

    self.frontend.on('connect', function(address, uuid, stream) {
        self.backend.dispatch({ op : 'rpc::online', uuid : uuid });
    })

    self.frontend.on('disconnect', function(uuid, stream) {
        self.backend.dispatch({ op : 'rpc::offline', uuid : uuid });
    })

    self.backend.on('connect', function(address, uuid, stream) {
        self.frontend.dispatch({ op : 'rpc::online', uuid : uuid });
    })

    self.backend.on('disconnect', function(uuid, stream) {
        self.frontend.dispatch({ op : 'rpc::offline', uuid : uuid });
    })

    self.frontend.digest(function(msg, uuid, stream) {
        msg._r = {
            uuid : uuid,
            designation : stream.designation,
            uuid : stream.uuid
        }

        self.backend.dispatch(msg);
    })

    self.backend.digest(function(msg, uuid) {
        self.frontend.dispatch(msg._uuid, msg);
    })
}
function Router(options) {
    var self = this;

    self.frontend = new Server({
        port : options.port, 
        auth : options.auth || options.secret,
        certificates : options.certificates,
        routing : true
    })


    // connect to relay destination
    if(options.client) {
        self.backend = new Client({
            address: options.client.address,
            auth: options.client.auth || options.client.secret || options.auth || options.secret,
            certificates: options.certificates || options.client.certificates,
            //node: options.node,
            designation: 'router',
            routes : self.frontend.streams
        })
    }
    else
    if(options.server) {
        self.backend = new Server({
            port : options.server.port, 
            auth : options.server.auth || options.server.secret || options.auth || options.secret,
            certificates : options.certificates || options.server.certificates,
            routes : self.frontend.streams
        })
    }
    else
        throw new Error("iris-rpc::Router() requires client or server")

    self.frontend.on('connect', function(address, uuid, stream) {
        self.backend.dispatch({ op : 'rpc::online', uuid : uuid });
    })

    self.frontend.on('disconnect', function(uuid, stream) {
        self.backend.dispatch({ op : 'rpc::offline', uuid : uuid });
    })

    self.backend.on('connect', function(address, uuid, stream) {
        self.frontend.dispatch({ op : 'rpc::online', uuid : uuid });
    })

    self.backend.on('disconnect', function(uuid, stream) {
        self.frontend.dispatch({ op : 'rpc::offline', uuid : uuid });
    })

    self.frontend.digest(function(msg, uuid, stream) {
        msg._r = {
            uuid : uuid,
            designation : stream.designation,
            uuid : stream.uuid
        }

        self.backend.dispatch(msg);
    })

    self.backend.digest(function(msg, uuid) {
        self.frontend.dispatch(msg._uuid, msg);
    })
}
Router - allows client->router->server (or client->router<-client) connectivity. This class is meant to help when a server is unable to handle maximum number of connections.