在回复超时内未收到任何响应。 Smack 4.2.0 muc.join()

时间:2018-04-10 05:32:23

标签: android xmpp openfire smack multiuserchat

我在我的项目中实现了MultiuserChat。

当我第一次加入小组时它工作正常。但是当我重新连接后重新加入群组时会出现错误。

加入群组代码:

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);

错误

 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)

你能帮我吗

2 个答案:

答案 0 :(得分:1)

@bhavesh

创建群组后,您将为成员分配成员资格。

放入muc1.grantOwnership(membersJid);而不是muc1.grantMembership(membersJid);

通过将所有成员都设为组(MUC)所有者,可以解决您的问题。

答案 1 :(得分:0)

org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout

通常,当用户的状态未更新到Openfire服务器并尝试加入会议室时,就会发生此异常。

因此,在onStop()上更新您的状态(不可用),并在onResume()上设置您的状态(可用)。

仍然,您会收到此异常,然后在异常时将用户的状态“不可用”发送到Openfire服务器,并在1-2秒后将状态“可用”发送给Openfire,然后加入组。