I have implemented web chat using xmpp + openfire + strophe. On the same openfire and xmpp server we have developed IOS chat as well.
I am facing below problem.
Lets say a user A connected in xmpp in IOS app and user A chat with user B.
Now same user A connect with web chat to xmpp using strophe and user B sends the message to user A then User A will have message in the web chat connection only.
Now user A connect with xmpp in IOS and User B send message then User A will get message in IOS app only, not in web chat.
Is it possible then user A will have message at all the connections which are created?
Does it possible a User will have multiple xmpp connections and all the connections are able to send message to another user and able to get messages at all the connections of the user?
Can you please help me to solve this issue in Strophe Js and IOS?
You can manage it by setting different RESOURCES (https://wiki.xmpp.org/web/Jabber_Resources).
Each device must declare a different Resource ("myPc", "android", "iphone", "ipad", "Spark", it's just an arbitrary String).
Openfire must be configurated to manage multiple Resources (Server -> Server Settings -> Resource Policy).
EDIT: Openfire has also a priority-based delivery system that chooses the highest priority resource and send only to it the message.
(a nice discussion: https://community.igniterealtime.org/thread/53377)
Enable by setting the property:
route.all-resources
to
true
According to this question, you need also
Openfire server, multiple connection, route.all-resources doesn't work
route.really-all-resources
setted to
true
HOW TO DO:
- by database, adding on "ofProperty" table both properties
- or by openfire web client -> Server -> Server Manager -> System
Property (add in on bottom of the page).
Keep in mind that
- Presence has a priority (a number between -128 and 128), default
it's 1. Carefully change this number.
- Of course clients must not include the resource while sending a
message (it's your case but pay attention to keep the right
behaviour)
I'm sorry about but I don't know how to assign a Resource name in Strophe.js as I see in some examples, programmers just add it manually as string concat (user@server/resource
while login)