2

I had implemented MultiuserChat in my project.

When I am joining a group for the first time it is working fine. But an error is coming when I join rejoin the group after reconnection.

Code of join group:

Resourcepart mResourcepart = Resourcepart.from(XmppManager.getInstance().getNickName());

MucEnterConfiguration.Builder builder = muc.getEnterConfigurationBuilder(mResourcepart);

long latOnlineTime = SharedPref.getLong(LAST_ONLINE_TIME, 0);

if (latOnlineTime > 0) {
      long diffMill = System.currentTimeMillis() - latOnlineTime;
      JLog.e(MUC_TAG, "SECONDS:" + diffMill / 1000);
      builder.requestHistorySince((int) (diffMill / 1000));
 } else {
      JLog.e(MUC_TAG, "No History INSIDE");
      builder.requestNoHistory();
 }

MucEnterConfiguration mucEnterConfiguration = builder.build();
muc.join(mucEnterConfiguration);

Error

 org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout. 
Timeout was 10000ms (~10s). Waited for response using: AndFilter: (StanzaTypeFilter: Presence, OrFilter: 
(AndFilter: (FromMatchesFilter (ignoreResourcepart): 9876543210@conference.ip-172-31-14-114.sa-east-1.compute.internal, 
MUCUserStatusCodeFilter: status=110), AndFilter: (FromMatchesFilter (full): 
9876543210@conference.ip-172-31-14-114.sa-east-1.compute.internal/9876543211, StanzaIdFilter: id=iAnSi-10, PresenceTypeFilter: type=error))).

at org.jivesoftware.smack.StanzaCollector.nextResultOrThrow(StanzaCollector.java:253)
at org.jivesoftware.smackx.muc.MultiUserChat.enter(MultiUserChat.java:346)
at org.jivesoftware.smackx.muc.MultiUserChat.join(MultiUserChat.java:702)
at com.myguei.xmpp.XmppService.getMultiUserChatConfig(XmppService.java:3069)
at com.myguei.xmpp.XmppService.getMultiUserChat(XmppService.java:2970)
at com.myguei.xmpp.XmppService.joinToGroup(XmppService.java:655)
at com.myguei.xmpp.XmppService.access$700(XmppService.java:165)
at com.myguei.xmpp.XmppService$6.run(XmppService.java:619)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.os.HandlerThread.run(HandlerThread.java:61)

Can you please help me

Bhavesh Jabuvani
  • 329
  • 1
  • 14

2 Answers2

1

@bhavesh

After creating group you are assigning membership to rosters.

Put muc1.grantOwnership(membersJid); instead of muc1.grantMembership(membersJid);

It will solve your problem by making all member as group (MUC) owner.

Amit
  • 409
  • 1
  • 5
  • 12
  • I have tried this solution but still i am getting this issue. Please let me know if something new in this. – Ninja Dec 22 '18 at 14:30
1
org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout

Generally, this exception comes when a user's presence is not updated to the Openfire server and try to join a room.

So update your presence(Unavailable) on onStop() And set your presence(Available) onResume().

Still, you get this exception then when this exception come, send user's presence "Unavailable" to the Openfire server. And after 1-2 sec sends presence "Available" and then try to join the group.

Bhavesh Jabuvani
  • 329
  • 1
  • 14