lib/transport-http-server.js
function createBaseTransport(req, res) {
    // A transport object.
    var self = new events.EventEmitter();
    // Because HTTP transport consists of multiple exchanges, an universally
    // unique identifier is required.
    self.id = uuid.v4();
    // A flag to check the transport is opened.
    var opened = true;
    self.on("close", function() {
        opened = false;
    });
    self.send = function(data) {
        // Allows to send data only it is opened. If not, fires an error.
        if (opened) {
            self.write(data);
        } else {
            self.emit("error", new Error("notopened"));
        }
        return this;
    };
    return self;
}
function createBaseTransport(req, res) {
    // A transport object.
    var self = new events.EventEmitter();
    // Because HTTP transport consists of multiple exchanges, an universally
    // unique identifier is required.
    self.id = uuid.v4();
    // A flag to check the transport is opened.
    var opened = true;
    self.on("close", function() {
        opened = false;
    });
    self.send = function(data) {
        // Allows to send data only it is opened. If not, fires an error.
        if (opened) {
            self.write(data);
        } else {
            self.emit("error", new Error("notopened"));
        }
        return this;
    };
    return self;
}
function createBaseTransport ( req , res ) { // A transport object. var self = new events . EventEmitter ( ) ; // Because HTTP transport consists of multiple exchanges, an universally // unique identifier is required. self . id = uuid . v4 ( ) ; // A flag to check the transport is opened. var opened = true ; self . on ( "close" , function ( ) { opened = false ; } ) ; self . send = function ( data ) { // Allows to send data only it is opened. If not, fires an error. if ( opened ) { self . write ( data ) ; } else { self . emit ( "error" , new Error ( "notopened" ) ) ; } return this ; } ; return self ; }
A base transport.
A base transport .