lib/greyhound.js
function(host) {
    if (!host)
        throw new Error('Need hostname to initialize reader');

    if (host.match(/^(\S+):\/\//))
            throw new Error('Protocol specified, need bare hostname');

    this.host = host;

    var portParts = this.host.match(/:(\d+)$/);
    if (portParts !== null)
        this.port = parseInt(portParts[1]);
    else
        this.port = 80;

    // make sure port stuff is taken out of the host
    //
    var hostParts = this.host.match(/^(\S+):/);
    if (hostParts)
        this.host = hostParts[1];
}
function(host) {
    if (!host)
        throw new Error('Need hostname to initialize reader');

    if (host.match(/^(\S+):\/\//))
            throw new Error('Protocol specified, need bare hostname');

    this.host = host;

    var portParts = this.host.match(/:(\d+)$/);
    if (portParts !== null)
        this.port = parseInt(portParts[1]);
    else
        this.port = 80;

    // make sure port stuff is taken out of the host
    //
    var hostParts = this.host.match(/^(\S+):/);
    if (hostParts)
        this.host = hostParts[1];
}
function ( host ) { if ( ! host ) throw new Error ( 'Need hostname to initialize reader' ) ; if ( host . match ( / ^(\S+):\/\/ / ) ) throw new Error ( 'Protocol specified, need bare hostname' ) ; this . host = host ; var portParts = this . host . match ( / :(\d+)$ / ) ; if ( portParts !== null ) this . port = parseInt ( portParts [ 1 ] ) ; else this . port = 80 ; // make sure port stuff is taken out of the host // var hostParts = this . host . match ( / ^(\S+): / ) ; if ( hostParts ) this . host = hostParts [ 1 ] ; }
A greyhound data reader implementation.  This class abstracts the details of reading data
from greyhound servers.

@example
var gh = new GrehoundReader("myserver.com");
// create a session
//
gh.createSession("pipelineid", function(err, id) {
// read some stats just for kicks
gh.getStats(id, function(err, stats) {
// print some informations
console.log("Mins:", stats.mins(), "Maxs:", stats.maxs());

// Read EVERYTHING
gh.read(id, function(err, data) {
// Do fun stuff with data
console.log("Read all the data");

// Finally destroy the session
gh.destroy(id, function(err) {
console.log("Bye");

// always a good practice to close this stuff
gh.close();
});
});
});
});

@class
@param {string} host - Should be a bare hostname with no protocol specified, but may specify a port name .e.g myserver.com:8012
@return {GreyhoundReader} When initialized with new, returns a new reader instance
A greyhound data reader implementation . This class abstracts the details of reading data from greyhound servers .