XMPP aSmack MultiUserChat 服务器继续发送已收到的消息

发布于 2025-01-06 02:57:37 字数 2911 浏览 1 评论 0原文

我是堆栈上的新用户,但我在适用于 android 的 aSmack 库 3.2.1 中的 MultiUserChat 上遇到问题。我正在使用“gtalk.google.com”服务器。这是一个简单的例子,我在房间里只有一个人:

 String room="[email protected]";
 MultiUserChat muc = new MultiUserChat(connection,room);
 muc.join(userNameInRoom);

 muc.addMessageListener(new PacketListener()
 {
    @Override
    public void processPacket(Packet packet)
    {
         ...
    }
 });

之后:

 muc.sendMessage("Text message");

在日志中:

DEBUG/SMACK(281): 06:46:29 PM SENT (1140866576): <message id="gsMe7-18"
to="[email protected]" type="groupchat"><body>Text message
</body></message>

DEBUG/SMACK(281): 06:46:29 PM RCV  (1140866576): <message
from="[email protected]/userNameInRoom" to="userName"
type="groupchat"><body>Text message</body></message>

结果:“短信”,这是正确的,但是:

我再次收到了“短信”,并且存在:

DEBUG/SMACK(281): 06:54:12 PM RCV  (1140866576): <presence 
from="[email protected]/userNameInRoom" to="userName"><x xmlns=
"vcard-temp:x:update"><photo/></x><x xmlns="http://jabber.org/protocol/muc#user">
<item affiliation="owner" role="moderator"/><status code="110"/></x></presence>

DEBUG/SMACK(281): 06:54:12 PM RCV  (1140866576): <message 
from="[email protected]/userNameInRoom" to="userName"
type="groupchat"><body>Text message</body><delay stamp="2012-02-15T17:46:31Z" 
from="[email protected]" xmlns="urn:xmpp:delay"/><x 
stamp="20120215T17:46:31" from="[email protected]" 
xmlns="jabber:x:delay"/></message>

并且每当服务器向我发送状态。它无限持续,间隔约 5 分钟。是的,在 30 分钟内我收到了 ~6 条消息“短信”。如果我发送多于 1 条消息,则当存在状态发送给我时,所有这些消息都会无一例外地被收到。

我的 MultiUserChat 有什么问题以及延迟交付在这里发生了什么?

感谢您的关注!

I'am a new user on stack, but I have a problem with MultiUserChat in aSmack library 3.2.1 for android. I'm using "gtalk.google.com" server. It's a simple example and I'am only one in room:

 String room="[email protected]";
 MultiUserChat muc = new MultiUserChat(connection,room);
 muc.join(userNameInRoom);

 muc.addMessageListener(new PacketListener()
 {
    @Override
    public void processPacket(Packet packet)
    {
         ...
    }
 });

After:

 muc.sendMessage("Text message");

In Log:

DEBUG/SMACK(281): 06:46:29 PM SENT (1140866576): <message id="gsMe7-18"
to="[email protected]" type="groupchat"><body>Text message
</body></message>

DEBUG/SMACK(281): 06:46:29 PM RCV  (1140866576): <message
from="[email protected]/userNameInRoom" to="userName"
type="groupchat"><body>Text message</body></message>

Result: "Text message" and it is right, but then:

I again recieved "Text message" with presences:

DEBUG/SMACK(281): 06:54:12 PM RCV  (1140866576): <presence 
from="[email protected]/userNameInRoom" to="userName"><x xmlns=
"vcard-temp:x:update"><photo/></x><x xmlns="http://jabber.org/protocol/muc#user">
<item affiliation="owner" role="moderator"/><status code="110"/></x></presence>

DEBUG/SMACK(281): 06:54:12 PM RCV  (1140866576): <message 
from="[email protected]/userNameInRoom" to="userName"
type="groupchat"><body>Text message</body><delay stamp="2012-02-15T17:46:31Z" 
from="[email protected]" xmlns="urn:xmpp:delay"/><x 
stamp="20120215T17:46:31" from="[email protected]" 
xmlns="jabber:x:delay"/></message>

And I recieved that again and again whenever server send presences to me. It continues infinitely with interval ~ 5 minutes. And Yes in 30 minutes I recieved ~6 messages "Text message". If I send more than 1 message all of these messages would been recieved without exceptions when presence send to me.

What problem with my MultiUserChat and what delayed delivery doing here?

Thanks for attention!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

空心空情空意 2025-01-13 02:57:37

对于“@conference.jabber.org”,我没有找到解决方案,我认为该问题是因为 GTalk 服务器和 MultiUserChat 的正确版本是“@groupchat.google.com”的情况。

我将代码从: 更改

room=roomName+"@conference.jabber.org";
MultiUserChat muc = new MultiUserChat(connection, room);

muc.create(userName);

muc.sendConfigurationForm(new Form(Form.TYPE_SUBMIT));

为:

room="private-chat-" + UUID.randomUUID().toString() + "@groupchat.google.com";
MultiUserChat muc = new MultiUserChat(connection, room);

muc.join(userName);

muc.sendConfigurationForm(new Form(Form.TYPE_SUBMIT));

我尝试了它,但遇到了新问题 - 当用户收到邀请消息并接受它时,两个客户端都会崩溃,并出现 XmlPullException“END_TAG预期” 以及类似“< /流:流>"在 logcat 的最后一个位置。

我开始用谷歌搜索这个问题并找到原因。我使用了beem客户端的asmack(顺便说一句,在此之前我使用了asmack开发人员的asmack-7)以及我如何知道它是基于smack 3.1...我发现smack 3.2.0决定了这个问题。我下载了 asmack 的 Flow 版本,对此我很满意。

最后我想说“谢谢!!!”到 Flow 获取正确版本的 aSmack,它比其他版本效果更好。

In case of "@conference.jabber.org" I didn't find solution and I decided that problem because of GTalk server and correct version of MultiUserChat is in case with "@groupchat.google.com".

I changed my code from:

room=roomName+"@conference.jabber.org";
MultiUserChat muc = new MultiUserChat(connection, room);

muc.create(userName);

muc.sendConfigurationForm(new Form(Form.TYPE_SUBMIT));

to:

room="private-chat-" + UUID.randomUUID().toString() + "@groupchat.google.com";
MultiUserChat muc = new MultiUserChat(connection, room);

muc.join(userName);

muc.sendConfigurationForm(new Form(Form.TYPE_SUBMIT));

And i tried it, but I got new problem- When user recieve invite message and accept it both clients crash with XmlPullException "END_TAG expected" and something like "< /stream:stream>" in last position in logcat.

I started to google this problem and found reason. I used asmack from beem client(by the way, before that i used asmack-7 from asmack developer) and how i know it is based on smack 3.1... I found that smack 3.2.0 decided this problem. I downloaded the Flow's version of asmack and I am pleased with this.

In conclusion I want to say "Thank you!!!" to Flow for correct version of aSmack, which works better than others.

汐鸠 2025-01-13 02:57:37

这不是因为您的客户端,也不是错误,那是因为您的服务器的群聊历史记录设置配置为在进入房间时发送特定数量的聊天历史记录

that is Not because of your Client, and thats Not an Error, Thats Because Your Server's GroupChat's History Settings Configured to Send particular Number of Chat History Upon Entering The Room

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文