XMPP多个选项卡同步已发送的消息 [英] XMPP Multiple tabs synchronize sent message

查看:83
本文介绍了XMPP多个选项卡同步已发送的消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Strophe.js在网站中实现Openfire聊天客户端.我设法获得多个会话和多个Windows重新加载页面并重新连接回去.现在,我在恢复聊天记录方面遇到了挑战. 但是我遇到的第一个问题是,当用户打开我们网站的两个选项卡时,它会创建两个具有不同资源ID的xmpp会话,但是现在说 a@example.com/tab1向朋友发送了一条消息,应该在tab2中进行同步

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

例如,如果您从gtalk发送聊天消息,则用户发送的消息将被更新并显示在gmail聊天窗口中.

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.

推荐答案

多个资源的路由逻辑取决于服务器实现. GTalk服务器会将发送到裸机的消息路由到所有连接的资源.许多其他服务器(也称为Openfire)将来自裸机的消息发送到最可用的资源,这是优先级最高的资源.

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.

这篇关于XMPP多个选项卡同步已发送的消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆