_handleIncomingMessage()

in src/core/chatController.js [192:214]


  _handleIncomingMessage(incomingData) {
    try {
      const eventType = incomingData.ContentType === CONTENT_TYPE.typing ? CHAT_EVENTS.INCOMING_TYPING : CHAT_EVENTS.INCOMING_MESSAGE;
      this._forwardChatEvent(eventType, {
        data: incomingData,
        chatDetails: this.getChatDetails()
      });
      if (incomingData.ContentType === CONTENT_TYPE.chatEnded) {
        this._forwardChatEvent(CHAT_EVENTS.CHAT_ENDED, {
          data: null,
          chatDetails: this.getChatDetails()
        });
        this.breakConnection();
      }
    } catch (e) {
      this.logger.error(
        "Error occured while handling message from Connection. eventData: ",
        incomingData,
        " Causing exception: ",
        e
      );
    }
  }