通过丢失的连接xmpp丢失消息 [英] Losing messages over lost connection xmpp

查看:143
本文介绍了通过丢失的连接xmpp丢失消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了这个问题

设备断开时通过XMPP丢失的消息

但没有答案。

当由于某些网络问题而导致连接丢失时,服务器将无法识别它,并继续向永久断开的接收方发送消息。

When a connection is lost due to some network issue then the server is not able to recognize it and keeps on sending messages to disconnected receiver which are permanently lost.

I有一种解决方法,可以从服务器ping客户端,并在客户端断开连接时,服务器可以在10秒后识别出该客户端,并将其他消息保存在队列中,以防止丢失。

I have a workaround in which i ping the client from server and when the client gets disconnected server is able to recognize it after 10 sec and save further messages in queue preventing them from being lost.

我的问题是,可以使用我知道psi和许多其他xmpp客户端正在执行的其他方式来实现100%失败保存消息的传递。

my question is can 100% fail save message delivery be achieved by using some other way i know psi and many other xmpp client are doing it.

在ios端,我正在使用xmppframework

on ios side i am using xmppframework

推荐答案

一种方法是在服务器上使用高级邮件处理(AMP);另一种方法是在您的客户端上使用邮件传递收据

One way is to employ the Advanced Message Processing (AMP) on your server; another one is to employ the Message Delivery Receipts on your clients.

前者需要启用AMP的服务器实现, 发起方的客户端必须能够告知服务器所需的交付状态报告(它希望< a href = http://xmpp.org/extensions/xep-0079.html#description-deliver rel = nofollow>如果无法交付则返回错误)。请注意,这无论如何都不是防弹的,因为在目标客户端与服务器之间失去连接与服务器计算机上的TCP堆栈检测到并告知服务器之间存在一个窗口:在此窗口中,所有内容发送到客户端的消息被服务器认为可以发送,因为在TCP层中没有消息边界的概念,因此,如果服务器进程设法将消息节的XML填充到其TCP连接的系统缓冲区中,则认为该节要发送&mdash;一旦TCP堆栈说连接丢失,它就无法知道流中的哪些位没有到达接收器。

The former one requires an AMP-enabled server implementation and the initiating client has to be able to tell the server what kind of delivery status reports it wants (it wants an error to be returned if the delivery is not possible). Note that this is not bullet-proof anyway as there is a window between the moment the target client losts its connectivity with the server and the moment the TCP stack on the server's machine detects this and tells the server about it: during this window, everything sent to the client is considered by the server to be sent okay because there's no concept of message boundaries in the TCP layer and hence if the server process managed to stuff a message stanza's XML into the system buffers of its TCP connection, it considers that stanza to be sent—there's no way for it to know which bits of its stream did not get to the receiver once the TCP stack says the connection is lost.

防弹,因为客户端依赖于有关消息接收的显式通知。但这确实增加了聊天感。作为回报,不需要此功能的服务器支持,并且仅在客户端中实现。

The latter one is bullet-proof as the clients rely on explicit notifications about message reception. This does increase chattiness though. In return, no server support for this feature is required—it's implemented solely in the clients.

这篇关于通过丢失的连接xmpp丢失消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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