【发布时间】:2018-10-23 17:50:27
【问题描述】:
我正在运行具有以下 mod_muc 配置的 ejabberd(18.3.0 版)服务器:
mod_muc:
host: "conference.@HOST@"
...
default_room_options:
allow_subscription: true
persistent: true
mam: true
我正在尝试从各种客户端访问此服务器上的 muc 房间(带有 xmppframework 的 ios,带有 node-xmpp-client 的 js - 手动制作 xmpp 命令)。客户端能够接收消息 - 仅当我在连接后发送 presence 消息时。
但是,如果不发送存在,我不会在客户端收到任何消息(即使订阅 成功)。我的理解是接收消息不需要 presence 消息(对于 mucsub)。
非常感谢任何帮助!
回应巴德洛普回复的更多细节
我将客户端/服务器上的 xml 消息与您发布的消息进行了比较。继续您使用的 user1/user2 示例,我看到 user2 的订阅成功:
<iq xmlns="jabber:client"
lang="en"
to="rk3@localhost/abcd"
from="tr21@conference.localhost"
type="result" id="D7550060-E2AE-4369-878C-261A02BA48A2">
<subscribe xmlns="urn:xmpp:mucsub:0" nick="rk3n">
<event node="urn:xmpp:mucsub:nodes:messages"/>
<event node="urn:xmpp:mucsub:nodes:presence"/>
</subscribe>
</iq>
另外,来自 user2 的 muc 服务查询结果如下:
<iq xmlns="jabber:client"
lang="en"
to="rk3@localhost/abcd"
from="conference.localhost" type="result" id="B28A237A-5D54-4AE2-821A-195272B05A88">
<subscriptions xmlns="urn:xmpp:mucsub:0">
<subscription jid="tr21@conference.localhost"/>
</subscriptions>
</iq>
但是,当我从 user1 发送群聊消息时:
<message
from="rk1@localhost" to="tr21@conference.localhost"
type="groupchat">
<body> hi there777hi there778</body>
</message>
User2 仍然没有收到上述消息。
我在 ejabberd 服务器上打开了日志级别 5,可以看到服务器正在尝试将上述消息发送给 User2 (rk3)。但是,我在服务器上看到的这条消息的最后一条日志如下(我没有看到这条消息的任何“Send XML on stream”日志)。
2018-05-14 16:28:57.808 [debug] <0.646.0>@ejabberd_sm:do_route:656 processing message to bare JID:
#message{
id = <<>>,type = normal,lang = <<>>,
from =
#jid{
user = <<"tr21">>,server = <<"conference.localhost">>,resource = <<>>,
luser = <<"tr21">>,lserver = <<"conference.localhost">>,lresource = <<>>},
to =
#jid{
user = <<"rk3">>,server = <<"localhost">>,resource = <<>>,
luser = <<"rk3">>,lserver = <<"localhost">>,lresource = <<>>},
subject = [],body = [],thread = undefined,
sub_els =
[#ps_event{
items =
#ps_items{
xmlns = <<>>,node = <<"urn:xmpp:mucsub:nodes:messages">>,
items =
[#ps_item{
xmlns = <<>>,id = <<"15241958194312511749">>,
sub_els =
[#message{
id = <<>>,type = groupchat,lang = <<"en">>,
from =
#jid{
user = <<"tr21">>,server = <<"conference.localhost">>,
resource = <<"rk1">>,luser = <<"tr21">>,
lserver = <<"conference.localhost">>,lresource = <<"rk1">>},
to =
#jid{
user = <<"rk3">>,server = <<"localhost">>,resource = <<>>,
luser = <<"rk3">>,lserver = <<"localhost">>,lresource = <<>>},
subject = [],
body = [#text{lang = <<>>,data = <<"hi there777hi there778">>}],
thread = undefined,
sub_els =
[#mam_archived{
by =
#jid{
user = <<"tr21">>,server = <<"conference.localhost">>,
resource = <<>>,luser = <<"tr21">>,
lserver = <<"conference.localhost">>,lresource = <<>>},
id = <<"1526283878998040">>},
#stanza_id{
by =
#jid{
user = <<"tr21">>,server = <<"conference.localhost">>,
resource = <<>>,luser = <<"tr21">>,
lserver = <<"conference.localhost">>,lresource = <<>>},
id = <<"1526283878998040">>}],
meta =
#{ip => {172,17,0,1},
mam_archived => true,stanza_id => 1526283878998040}}],
node = <<>>,publisher = <<>>}],
max_items = undefined,subid = <<>>,retract = undefined},
purge = undefined,subscription = undefined,delete = undefined,
create = undefined,configuration = undefined}],
meta = #{stanza_id => 1526283879010097}}
我可能遗漏了一些非常基本的东西(w.r.t user / nick / muc room 等),但不知道是什么。
您能否告诉我您在服务器上创建 user1/user2、注册他们的昵称等的步骤(使用 ejabberdctl)?
【问题讨论】: