AnsweredAssumed Answered

Smack 4.1.3 Strophe Send Message Delay

Question asked by Elsa on Oct 8, 2015
Latest reply on Oct 9, 2015 by Elsa

I'm using Smack 4.1.3 on an Android App to send and receive messages from Strophe Web client. In both applications I'm using BoshConnections. The messages are sent and received correctly, but when I send a message from the Android app, it takes 1-2 mins for Strophe client to get the message. However, if during that interval, I send a message from Strophe to Android app, the message that is pending arrives immediately in the Android App. Also the messages sent from strophe arrive immediately in the android app. Thanks

This is the code I'm using for listening for messages:


public void MessageListener(){
  if(chatManager == null && commonChat == null){
  chatManager = ChatManager.getInstanceFor(boshConnection);
  chatManager.addChatListener(new ChatManagerListener() {
  public void chatCreated(Chat chat, boolean createdLocally) {
  commonChat = chat;
  chat.addMessageListener(new ChatMessageListener() {
  public void processMessage(Chat chat, Message message) {
  if (message.getBody() != null) {
  commonChat = chat;
  String fromUser = chat.getParticipant();
  String msgBody = message.getBody();
  String messageToShow = fromUser + ":" + msgBody;
  Log.i(TAG, fromUser + ":" + messageToShow);



And for sending messages:

public void SendMessagebyUser(String userName, String message){


   try {

   if(commonChat !=null) {




  Chat chatOBJ = chatManager.createChat(userName);



  } catch (Exception e) {

  Log.i(TAG, "User not connected exception");