How to use the @cometchat-pro/chat.CometChat.RECEIVER_TYPE 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
// Handle text message
            senderID = textMessage.sender.uid;
            messageId = textMessage.id;

            if (senderID !== this.props.subjectUID) {
              CometChat.markMessageAsRead(
                textMessage
              );
            }
            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]
              });
            }
            
          }
github cometchat-pro-samples / javascript-reactjs-chat-app / src / js / store / actions / cc_action.js View on Github external
return dispatch => {
    let messageType = CometChat.MESSAGE_TYPE.TEXT;
    let receiverType = CometChat.RECEIVER_TYPE.USER;
    let textMessage = new CometChat.TextMessage(
      receiverID,
      messageText,
      messageType,
      receiverType
    );
    textMessage.setId(messageId);
    CometChat.editMessage(textMessage).then(
      message => {
        dispatch(editMessage(message));
      },
      error => {
        console.log("Message editing failed with error:", error);
      }
    );
  };
github cometchat-pro-samples / javascript-reactjs-chat-app / src / components / cometchat / ChatBody.jsx View on Github external
handleTextInputChange = e => {
    this.setState({ newMessage: e.target.value });

    if (this.props.activeConversation.uid !== undefined) {
      let receiverId = this.props.activeConversation.uid;

      let receiverType = CometChat.RECEIVER_TYPE.USER;

      let typingNotification = new CometChat.TypingIndicator(
        receiverId,
        receiverType
      );

      if (e.target.value === "") CometChat.endTyping(typingNotification);
      else CometChat.startTyping(typingNotification);
    } else if (this.props.activeConversation.guid !== undefined) {
      let receiverId = this.props.activeConversation.guid;

      let receiverType = CometChat.RECEIVER_TYPE.GROUP;

      let typingNotification = new CometChat.TypingIndicator(
        receiverId,
        receiverType
github cometchat-pro-samples / javascript-reactjs-chat-app / src / js / components / message / CCMessageFooter.js View on Github external
endTyping=()=>{
    if(this.props.activeMessageType == "user"){
      let receiverId =  this.props.activeUser;
      let receiverType = CometChat.RECEIVER_TYPE.USER;
      let metadata = {
        text : ""
      };
      let typingNotification = new CometChat.TypingIndicator(receiverId,receiverType,metadata);
      CometChat.endTyping(typingNotification);
    }
  }