WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

*/

var httpp = require('httpp'),
    http = require('http'),
    util = require('util'),
    colors = require('colors'),
    httpProxy = require('../../lib/node-http-proxy');
    
//
// Create the target HTTPP server 
//
httpp.createServer(function (req, res) {
  res.writeHead(200, { 'Content-Type': 'text/plain' });
  res.write('hello httpp over http\n');
  res.end();
}).listen(8000);

//
// Create the proxy HTTP->HTTPP server listening on port 8080
//
httpProxy.createServer({
  target: {
    httpp: true,
	host: 'localhost',
	port: 8000
  },
  httpp: false
}).listen(8080);
Example #2
0
var args = "";
var options = null;

var app = http.createServer(function (req, res) {
    var date = new Date();
    res.writeHead(200, {
      'Date':date.toUTCString(),
      'Connection':'close',
      'Cache-Control':'private',
      'Content-Type':'video/webm',
      'Server':'CustomStreamer/0.0.1',
    });
    var server = net.createServer(function(socket){
        socket.on('data', function (data) {
          res.write(data);
        });
        socket.on('close', function (had_error) {
          res.end();
        });
      });
    server.listen(function(){
        args = [server.address().port, "/dev/video0"];
        console.log("muxer started on port : " + args);
        var gstMuxer = child.spawn(cmd, args, options);
        gstMuxer.stderr.on('data', onSpawnError);
        gstMuxer.on('exit', onSpawnExit);
        res.connection.on('close', function(){ gstMuxer.kill(); });
      });
  });

app.listen(5000);
console.log('Node-UDT stream server running on 5000');