I am running an ejabberd (ver 18.3.0) server with the following config for mod_muc:
mod_muc:
host: "conference.@HOST@"
...
default_room_options:
allow_subscription: true
persistent: true
mam: true
I am trying to access the muc rooms on this server from various clients (ios with xmppframework, js with node-xmpp-client - crafting the xmpp commands manually). The clients are able to receive messages - ONLY IF I send a presence message after connecting.
However, without sending a presence, I don't receive any messages on the client (even though the subscribe is successful). My understanding was that the presence message is not required to receive messages (for mucsub).
Any help is highly appreciated!
Additional details in response to Badlop's reply
I compared the xml messages on my client/server to the ones you posted. Continuing the user1/user2 example you used, I see a success for user2's subscribe:
<iq xmlns="jabber:client"
lang="en"
to="rk3@localhost/abcd"
from="[email protected]"
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>
Also, a query of the muc service from user2 results in the below:
<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="[email protected]"/>
</subscriptions>
</iq>
However, when I send a groupchat message from user1:
<message
from="rk1@localhost" to="[email protected]"
type="groupchat">
<body> hi there777hi there778</body>
</message>
User2 is still not receiving the above message.
I turned on logging level 5 on ejabberd server and can see that the server is trying to send the above message to User2 (rk3). However, the last log I see for this message on the server is below (I don’t see any ‘Send XML on stream’ log for this message).
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}}
I am probably missing something very basic (w.r.t user / nick / muc room etc) but have no idea what.
Can you please give me the steps you used to create user1/user2, register their nicks etc on the server (using ejabberdctl)?