example/connectors/HTTPDuplexStream.js
function ServerClientStream(app){
    var StreamHandler;
    app.use(function(req, res, next){
      if(req.originalUrl == '/promise-pipe-connector' && req.method=='POST'){
        var message = req.body;
        message._response = res;
        StreamHandler(message)
      } else {
        return next();
      }
    });
    return {
      send: function(message){
        if(!message._response) throw Error("no response defined");
        var res = message._response;
        message._response = undefined;
        res.json(message);
      },
      listen: function(handler){
        StreamHandler = handler;
      }
    }
  }
function ServerClientStream(app){
    var StreamHandler;
    app.use(function(req, res, next){
      if(req.originalUrl == '/promise-pipe-connector' && req.method=='POST'){
        var message = req.body;
        message._response = res;
        StreamHandler(message)
      } else {
        return next();
      }
    });
    return {
      send: function(message){
        if(!message._response) throw Error("no response defined");
        var res = message._response;
        message._response = undefined;
        res.json(message);
      },
      listen: function(handler){
        StreamHandler = handler;
      }
    }
  }
function ServerClientStream ( app ) { var StreamHandler ; app . use ( function ( req , res , next ) { if ( req . originalUrl == '/promise-pipe-connector' && req . method == 'POST' ) { var message = req . body ; message . _response = res ; StreamHandler ( message ) } else { return next ( ) ; } } ) ; return { send : function ( message ) { if ( ! message . _response ) throw Error ( "no response defined" ) ; var res = message . _response ; message . _response = undefined ; res . json ( message ) ; } , listen : function ( handler ) { StreamHandler = handler ; } } }
express app highly experimental
express app highly experimental