lib/lozigo.js
function() {
  var that = this;
  var boundEmitComplete = emitComplete.bind(this);
  
  EventEmitter.call(this);

  this.middleware = [];
  this.server = net.createServer(function(conn) {
    var buffer = '';
    var info = null;

    conn.on('data', function(data) {
      buffer += data;

      if(!info) {
        if(buffer.indexOf('\f') !== -1) {
          var split = buffer.split('\f');
          
          try {
            info = JSON.parse(split[0]);
            buffer = split[1];
          } catch(e) {
            that.emit('error', e);
          }
        }
      }

      if(buffer && info) {
        handleEntries(buffer, info, that.middleware, boundEmitComplete);
        buffer = '';
      }
    });

    conn.on('end', function() {
      that.emit('end');
    });

    conn.on('error', function(err) {
      that.emit('error', err);
    });
  });
}
function() {
  var that = this;
  var boundEmitComplete = emitComplete.bind(this);
  
  EventEmitter.call(this);

  this.middleware = [];
  this.server = net.createServer(function(conn) {
    var buffer = '';
    var info = null;

    conn.on('data', function(data) {
      buffer += data;

      if(!info) {
        if(buffer.indexOf('\f') !== -1) {
          var split = buffer.split('\f');
          
          try {
            info = JSON.parse(split[0]);
            buffer = split[1];
          } catch(e) {
            that.emit('error', e);
          }
        }
      }

      if(buffer && info) {
        handleEntries(buffer, info, that.middleware, boundEmitComplete);
        buffer = '';
      }
    });

    conn.on('end', function() {
      that.emit('end');
    });

    conn.on('error', function(err) {
      that.emit('error', err);
    });
  });
}
function ( ) { var that = this ; var boundEmitComplete = emitComplete . bind ( this ) ; EventEmitter . call ( this ) ; this . middleware = [ ] ; this . server = net . createServer ( function ( conn ) { var buffer = '' ; var info = null ; conn . on ( 'data' , function ( data ) { buffer += data ; if ( ! info ) { if ( buffer . indexOf ( '\f' ) !== - 1 ) { var split = buffer . split ( '\f' ) ; try { info = JSON . parse ( split [ 0 ] ) ; buffer = split [ 1 ] ; } catch ( e ) { that . emit ( 'error' , e ) ; } } } if ( buffer && info ) { handleEntries ( buffer , info , that . middleware , boundEmitComplete ) ; buffer = '' ; } } ) ; conn . on ( 'end' , function ( ) { that . emit ( 'end' ) ; } ) ; conn . on ( 'error' , function ( err ) { that . emit ( 'error' , err ) ; } ) ; } ) ; }
Main Lozigo Object
Main Lozigo Object