简体   繁体   English

iOS:XMPP与旧式SSL连接重新连接

[英]iOS: XMPP Reconnect with Old School SSL connection

XMPPFramework provides an extension named XMPPReconnect for "accidental disconnections" and automatically reconnects the stream. XMPPFramework提供了名为XMPPReconnect的扩展,用于“意外断开连接”,并自动重新连接流。

This works well on the setting of the normal connection: 这在正常连接的设置上效果很好:

[xmppStream connect:&error]
[xmppStream setHostPort:5222];
allowSelfSignedCertificates = NO;
allowSSLHostNameMismatch = NO;

but not for this Old School SSL connection: 但不适用于此Old School SSL连接:

[xmppStream oldSchoolSecureConnect:&error]
[xmppStream setHostPort:5223];
allowSelfSignedCertificates = YES;
allowSSLHostNameMismatch = YES;

The error libxmlErrorDomain as error code 4 with the description Document is empty was thrown continuously, 连续抛出错误libxmlErrorDomain ,错误代码为4 ,描述Document is empty

sometimes, the error GCDAsyncSocketErrorDomain as error code 4 with description Read operation timed out also thrown. 有时,还会抛出错误GCDAsyncSocketErrorDomain (错误代码4并带有描述Read operation timed out错误代码4

Please suggest me the way to make the XMPPReconnect work on the Old School SSL connection. 请向我建议使XMPPReconnect在Old School SSL连接上工作的方法。

PS The XMPP server is openfire and the PLAIN mechanism for authentication. PS XMPP服务器是openfire ,使用PLAIN机制进行身份验证。

I don't think the Reconnect Extension of the XMPPFramework knows about old school ssl connection. 我认为XMPPFramework的Reconnect Extension不了解老式的SSL连接。 IMHO you will have to modify 'XMPPReconnect.m' function 'maybeAttemptReconnectWithReachabilityFlags:' to do something like: 恕我直言,您将必须修改“ XMPPReconnect.m”函数“ maybeAttemptReconnectWithReachabilityFlags:”以执行以下操作:

if(self.usesLegacyConnect) 
   [xmppStream oldSchoolSecureConnect:nil];
} else {
   [xmppStream connect:nil];
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM