How to use the @cometchat-pro/chat.CometChat.markMessageAsRead function in @cometchat-pro/chat

To help you get started, we’ve selected a few @cometchat-pro/chat examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cometchat-pro-samples / javascript-reactjs-chat-app / src / components / cometchat / ChatBody.jsx View on Github external
this.setState({
              msghistory: [...this.state.msghistory, textMessage]
            });
            this.props.handleOnRecentMessageSent(messageId);

          } else if (
            textMessage.receiverType === CometChat.RECEIVER_TYPE.GROUP &&
            textMessage.receiverId === this.props.activeConversation.guid
          ) {
            if(textMessage.sender.uid !== this.props.subjectUID)
            {
              // Handle text message
              senderID = textMessage.sender.uid;
              messageId = textMessage.id;
             
              CometChat.markMessageAsRead(textMessage);
              this.props.handleOnRecentMessageSent(messageId);
              this.setState({
                msghistory: [...this.state.msghistory, textMessage]
              });
            }
            
          }
          this.scrollToBottom();
        },
        onMediaMessageReceived: mediaMessage => {
github cometchat-pro-samples / javascript-reactjs-chat-app / src / components / cometchat / ChatBody.jsx View on Github external
messages => {
          
          if (!_.isEmpty(messages)) {
            const last_message = _.last(messages);
            if (last_message.sender.uid !== this.props.subjectUID) {
              CometChat.markMessageAsRead(last_message);
            }
          }
          this.setState({ msghistory: messages });
          this.scrollToBottom();
          
        },
        error => {
github cometchat-pro-samples / javascript-reactjs-chat-app / src / components / cometchat / ChatBody.jsx View on Github external
CometChat.markMessageAsRead(
                mediaMessage
              );
              this.props.handleOnRecentMessageSent(messageId);

          } else if (
            mediaMessage.sender.guid !== undefined &&
            mediaMessage.sender.guid === this.props.activeConversation.guid
          ) {
            this.setState({
              msghistory: [...this.state.msghistory, mediaMessage]
            });
            messageId = mediaMessage.id;
            senderID = mediaMessage.sender.uid;
            if (senderID !== this.props.subjectUID)
              CometChat.markMessageAsRead(mediaMessage);

              this.props.handleOnRecentMessageSent(messageId);
          }
          this.scrollToBottom();
        },
        onMessageRead: messageReceipt => {