lib/protocol/Connection.js
function ondata(chunk) {
    packet.push(chunk);
    if (packet.isReady()) {
      if (self._state.sessionId !== packet.header.sessionId) {
        self._state.sessionId = packet.header.sessionId;
        self._state.packetCount = -1;
      }
      var buffer = packet.getData();
      packet.clear();
      var cb = self._state.receive;
      self._state.receive = undefined;
      self._state.messageType = undefined;
      self.receive(buffer, cb);
    }
  }
function ondata(chunk) {
    packet.push(chunk);
    if (packet.isReady()) {
      if (self._state.sessionId !== packet.header.sessionId) {
        self._state.sessionId = packet.header.sessionId;
        self._state.packetCount = -1;
      }
      var buffer = packet.getData();
      packet.clear();
      var cb = self._state.receive;
      self._state.receive = undefined;
      self._state.messageType = undefined;
      self.receive(buffer, cb);
    }
  }
function ondata ( chunk ) { packet . push ( chunk ) ; if ( packet . isReady ( ) ) { if ( self . _state . sessionId !== packet . header . sessionId ) { self . _state . sessionId = packet . header . sessionId ; self . _state . packetCount = - 1 ; } var buffer = packet . getData ( ) ; packet . clear ( ) ; var cb = self . _state . receive ; self . _state . receive = undefined ; self . _state . messageType = undefined ; self . receive ( buffer , cb ) ; } }
register listerners on socket
register listerners on socket