我在项目中实现了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)
你能帮我么
最佳答案
@bhavesh
创建组后,您将为成员分配成员。
放置muc1.grantOwnership(membersJid);
而不是muc1.grantMembership(membersJid);
通过使所有成员成为组(MUC)所有者,它将解决您的问题。