How to use the @cometchat-pro/chat.CometChat.MessagesRequestBuilder 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 / js / lib / cometchat / ccManager.js View on Github external
static messageRequestBuilder(uType,uid, limit) {
    var messagesRequest  = "";
    if(uType == "user"){
      messagesRequest = new CometChat.MessagesRequestBuilder().setUID(uid).setLimit(limit).build();
    }else{
      messagesRequest = new CometChat.MessagesRequestBuilder().setGUID(uid).setLimit(limit).build();
    }
    return messagesRequest;
  }
github cometchat-pro-samples / javascript-reactjs-chat-app / src / components / cometchat / ChatBody.jsx View on Github external
this.props.activeConversation.membersCount !==
            prevProps.activeConversation.membersCount) ||
        this.props.callActive !== prevProps.callActive)
    ) {
      var limit = 200;
      let messagesRequest;
      let otherUID;
      if (this.props.activeConversation.guid !== undefined) {
        otherUID = this.props.activeConversation.guid;
        messagesRequest = new CometChat.MessagesRequestBuilder()
          .setLimit(limit)
          .setGUID(otherUID)
          .build();
      } else {
        otherUID = this.props.activeConversation.uid;
        messagesRequest = new CometChat.MessagesRequestBuilder()
          .setLimit(limit)
          .setUID(otherUID)
          .build();
      }

      messagesRequest.fetchPrevious().then(
        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();
github cometchat-pro-samples / javascript-reactjs-chat-app / src / js / lib / cometchat / ccManager.js View on Github external
static messageRequestBuilder(uType,uid, limit) {
    var messagesRequest  = "";
    if(uType == "user"){
      messagesRequest = new CometChat.MessagesRequestBuilder().setUID(uid).setLimit(limit).build();
    }else{
      messagesRequest = new CometChat.MessagesRequestBuilder().setGUID(uid).setLimit(limit).build();
    }
    return messagesRequest;
  }