src/js/lib/RTRemoteProtocol.js
/**
   * income a message from other side
   * @param {object} message the remote message object
   */
income a message from other side
@param {object} message the remote message object
income a message from other side @param { object } message the remote message object
incomeMessage(message) {
    const key = message[RTConst.CORRELATION_KEY];
    const callContext = this.futures[key];
    if (callContext) { 
      if (callContext.expired) { 
      } else {
        clearTimeout(callContext.timeoutHandler); 
      }
      if (message[RTConst.STATUS_CODE] !== RTStatusCode.OK) { 
        callContext.reject(helper.getStatusStringByCode(message[RTConst.STATUS_CODE]));
      } else {
        this.injectProtocolToMessageObjectValue(message);
        callContext.resolve(message[RTConst.VALUE] || message[RTConst.FUNCTION_RETURN_VALUE]); 
      }
    } else if (message[RTConst.MESSAGE_TYPE] === RTRemoteMessageType.KEEP_ALIVE_REQUEST) {
      this.transport.send(RTRemoteSerializer
        .toBuffer(RTMessageHelper.newKeepAliveResponse(message[RTConst.CORRELATION_KEY], RTStatusCode.OK)));
    } else if (message[RTConst.MESSAGE_TYPE] === RTRemoteMessageType.KEEP_ALIVE_RESPONSE) {
    } else if (message[RTConst.MESSAGE_TYPE] === RTRemoteMessageType.SESSION_OPEN_REQUEST) {
      this.transport.send(RTRemoteSerializer
        .toBuffer(RTMessageHelper.newOpenSessionResponse(message[RTConst.CORRELATION_KEY], message[RTConst.OBJECT_ID_KEY])));
    } else if (RTEnvironment.isServerMode()) {
      this.processMessageInServerMode(message);
    } else {
      this.processMessageInClientMode(message);
    }
  }
incomeMessage ( message ) { const key = message [ RTConst . CORRELATION_KEY ] ; const callContext = this . futures [ key ] ; if ( callContext ) { if ( callContext . expired ) { } else { clearTimeout ( callContext . timeoutHandler ) ; } if ( message [ RTConst . STATUS_CODE ] !== RTStatusCode . OK ) { callContext . reject ( helper . getStatusStringByCode ( message [ RTConst . STATUS_CODE ] ) ) ; } else { this . injectProtocolToMessageObjectValue ( message ) ; callContext . resolve ( message [ RTConst . VALUE ] || message [ RTConst . FUNCTION_RETURN_VALUE ] ) ; } } else if ( message [ RTConst . MESSAGE_TYPE ] === RTRemoteMessageType . KEEP_ALIVE_REQUEST ) { this . transport . send ( RTRemoteSerializer . toBuffer ( RTMessageHelper . newKeepAliveResponse ( message [ RTConst . CORRELATION_KEY ] , RTStatusCode . OK ) ) ) ; } else if ( message [ RTConst . MESSAGE_TYPE ] === RTRemoteMessageType . KEEP_ALIVE_RESPONSE ) { } else if ( message [ RTConst . MESSAGE_TYPE ] === RTRemoteMessageType . SESSION_OPEN_REQUEST ) { this . transport . send ( RTRemoteSerializer . toBuffer ( RTMessageHelper . newOpenSessionResponse ( message [ RTConst . CORRELATION_KEY ] , message [ RTConst . OBJECT_ID_KEY ] ) ) ) ; } else if ( RTEnvironment . isServerMode ( ) ) { this . processMessageInServerMode ( message ) ; } else { this . processMessageInClientMode ( message ) ; } }
income a message from other side
 @param {object} message the remote message object
income a message from other side @param { object } message the remote message object
// call context // call timeout, already return error, so ignore this // clear timeout handler // status error, reject directly // resolve // other side send keep a live request, so must return keep alive response with status ok // that's mean this program send keep live request to other side, and got reponse from other side // so this reponse can be ignored