0
votes

I'm creating a web XMPP client to connect to an XMPP ejabberd server and I have the following problem:

  • My client can send messages just alright.
  • The problem is when I try to receive messages. I only receive stanzas directed to my full JID, that is including the resource I am using, so I don't receive stanzas directed to my user@domain but I do receive stanzas sent to my user@domain/resource.

This is not an ideal situation since the other clients I need to communicate with work with bare JIDs.

I have little experience with Strophe so maybe someone with more experience can illustrate what I'm doing wrong. Thanks in advance!

1

1 Answers

2
votes

Have you checked if your xmpp server offers a setting to route messages to all resources?

OpenFire offers a property named route.all-resources which will forward messages to all resources for a person.

Also, you may want to adjust the priority of your resource, as only the resource with the highest priority will have the message sent to it (if the message does not specify a resource).

Here is an example of setting your resource priority to 10 with Strophe.js

connection.send($pres().c("priority").t("10"));

This article describes the intended behaviour, and also this answer from a related question may help you understand what's happening.