XMPP Multiple tabs synchronize sent message

守給你的承諾、 提交于 2019-12-11 06:43:30

问题


I am implementing an Openfire chat client in a web site with Strophe.js. I managed to get multiple sessions and multiple windows reloading page and reconnecting back. Now I have challenge in restoring the chat history. But the first issue I am stuck at when a user opens two tabs of our site it creates two xmpp sessions with different resource ID's but now say a@example.com/tab1 sent a message to friend this should be synchronized in tab2

Example if you send chat message from gtalk user sent message will be updated and showin in gmail chat window.

Any one has any idea. Thanks you very much for the time and help.


回答1:


The routing logic for multiple resources is up to the server implementation. The GTalk server routes messages sent to bare Jids to all connected resources. Many other servers (also Openfire) send messages to bare Jids to the most available resource, which is the one with the highest priority.

If each of your tabs has its own resource then I suggest to send the messages to each resource (full jid) manual. You get all connected resources of your subscribed contacts with the presence.




回答2:


Yes, there is. Have a look at XEP-0280: Message Carbons ( http://xmpp.org/extensions/xep-0280.html )

Both your client as well as your server have to support it in order to fully work.

Source : https://superuser.com/questions/866785/is-there-a-way-to-sync-xmpp-messages-across-different-devices-with-standard-xmp



来源:https://stackoverflow.com/questions/14349875/xmpp-multiple-tabs-synchronize-sent-message

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!