I have the following situation. We are using one JID to connect to the ejabberd, but with different resources to diffirentiate users. If for some reason message is sent to the resource that is not available/exist at the moment then this message is sent to all resources within JID.
We tried to find an information over the documentation and with chatbots if there is any possibility to solve it with settings, but it seems that there is no such possibility. We also tried to create custom module, but due to very limited knowledge of the language we failed with this as well.
Maybe someone had similar problem and know the solution or can share module for dealing with this?
What you describe is the behavior defined in the XMPP protocol. You should try, as much as possible, to follow the protocol without requiring custom changes: that way your system will work with any XMPP server, and with any version of the server.
More concretely, the protocol text relevant for your problem is:
https://xmpp.org/rfcs/rfc6121.html#rules-localpart-fulljid-nomatch
You send a message stanza of type "chat" indicating as destination the full JID
localpart@domainpart/resourcepart, but there isn't any session on thatresourcepart.Section
8.5.3.2.1. Messagesays:If you don't want that message to be delivered to other sessions, the clients should login with negative priority. That tip is explained in the text:
How to set presence priority? Most XMPP clients support setting that value, if you use some XMPP library to write your client, it should also support setting priority. If you can sniff the network traffic, check here how the initial presence stanza should look:
https://xmpp.org/rfcs/rfc6121.html#presence-syntax-children-priority