1
votes

I'm trying to figure out how to format a presence stanza being sent to a room, and I'm not following the examples I've found online.

presence_stanza = f"<presence xmlns='jabber:client' from='{user_id}@conference.domain.com/{what_goes_here} to='{room_id}@conference.domain.com'/>"

In particular I'm unsure what the ID/string that follows the / in the from address.

For reference:

https://www.ejabberd.im/node/5189/index.html

Ejabberd not sending presence stanza to other roster members

1

1 Answers

1
votes

You should read the Multi-User chat specification, especially the part that describes how to enter the room: https://xmpp.org/extensions/xep-0045.html#enter

The spec example is well commented.

You do not even need to set the from. The server will set it for you to your current session full JID. The to needs to be a full JID including indeed the room_id, but also the nickname of your user in the room. It should be something like:

<presence to='{room_id}@conference.domain.com/{user_nick_in_the_room}'/>