Ibm mobilefirst IBM Worklight 6.1-如何在较慢的网络中处理超时?

Ibm mobilefirst IBM Worklight 6.1-如何在较慢的网络中处理超时?,ibm-mobilefirst,Ibm Mobilefirst,我们已经为iOS5、iOS6和IOS7构建了一个使用Worklight 6.1的应用程序,它工作得非常好 然而,当我们试图在2G网络中使用app时,它甚至没有连接到服务器。每次我们得到一个超时,在尝试10-15次后,它将连接到服务器并返回响应 当我们在其他良好的网络或3G上使用相同的应用程序时,它工作得非常好,没有问题 这是我们在使用2G网络时在Xcode Organizer控制台中看到的日志: Jan 17 16:50:53 My-iPad Sec Sec[292] <Warning&g

我们已经为
iOS5
iOS6
IOS7
构建了一个使用
Worklight 6.1
的应用程序,它工作得非常好

然而,当我们试图在2G网络中使用app时,它甚至没有连接到服务器。每次我们得到一个超时,在尝试10-15次后,它将连接到服务器并返回响应

当我们在其他良好的网络或3G上使用相同的应用程序时,它工作得非常好,没有问题

这是我们在使用2G网络时在Xcode Organizer控制台中看到的日志:

Jan 17 16:50:53 My-iPad Sec Sec[292] <Warning>: WLRequestBuilder.initWithRootUrl else_url: https://domain.com:443/MyApp/apps/services/api/MyApp/ipad/0/query
Jan 17 16:50:55 My-iPad Sec Sec[292] <Warning>: LSHelperClient: Session started with polling: NO
Jan 17 16:50:59 My-iPad Sec Sec[292] <Warning>: Incorrect NSStringEncoding value 0x0000 detected. Assuming NSASCIIStringEncoding. Will stop this compatiblity mapping behavior in the near future.
Jan 17 16:50:59 My-iPad Sec Sec[292] <Warning>: [ERROR] Worklight: -[WLRequest requestFailed:]:338::Status code='0' error='The request timed out'
Jan 17 16:50:59 My-iPad Sec Sec[292] <Warning>: Incorrect NSStringEncoding value 0x0000 detected. Assuming NSASCIIStringEncoding. Will stop this compatiblity mapping behavior in the near future.
Jan 17 16:50:59 My-iPad Sec Sec[292] <Warning>: Incorrect NSStringEncoding value 0x0000 detected. Assuming NSASCIIStringEncoding. Will stop this compatiblity mapping behavior in the near future.
Jan 17 16:50:59 My-iPad Sec Sec[292] <Warning>: [ERROR] Worklight: -[WLClient onInvokeProcedureFailure:userInfo:]:696::response string=''
Jan 17 16:50:59 My-iPad kernel[0] <Debug>: AppleAP3GDL::handleInterrupt2 FIFO is Empty
Jan 17 16:51:08 My-iPad Sec Sec[292] <Warning>: WLRequestBuilder.initWithRootUrl else_url: https://domain.com:443/MyApp/apps/services/api/MyApp/ipad/0/query
Jan 17 16:51:14 My-iPad Sec Sec[292] <Warning>: Incorrect NSStringEncoding value 0x0000 detected. Assuming NSASCIIStringEncoding. Will stop this compatiblity mapping behavior in the near future.
Jan 17 16:51:14 My-iPad Sec Sec[292] <Warning>: [ERROR] Worklight: -[WLRequest requestFailed:]:338::Status code='0' error='The request timed out'
Jan 17 16:51:14 My-iPad Sec Sec[292] <Warning>: Incorrect NSStringEncoding value 0x0000 detected. Assuming NSASCIIStringEncoding. Will stop this compatiblity mapping behavior in the near future.
Jan 17 16:51:14 My-iPad Sec Sec[292] <Warning>: Incorrect NSStringEncoding value 0x0000 detected. Assuming NSASCIIStringEncoding. Will stop this compatiblity mapping behavior in the near future.
Jan 17 16:51:14 My-iPad Sec Sec[292] <Warning>: [ERROR] Worklight: -[WLClient onInvokeProcedureFailure:userInfo:]:696::response string=''
Jan 17 16:51:17 My-iPad Sec Sec[292] <Warning>: WLRequestBuilder.initWithRootUrl else_url: https://domain.com:443/MyApp/apps/services/api/MyApp/ipad/0/query
Jan 17 16:51:23 My-iPad Sec Sec[292] <Warning>: Incorrect NSStringEncoding value 0x0000 detected. Assuming NSASCIIStringEncoding. Will stop this compatiblity mapping behavior in the near future.
Jan 17 16:51:23 My-iPad Sec Sec[292] <Warning>: [ERROR] Worklight: -[WLRequest requestFailed:]:338::Status code='0' error='The request timed out'
Jan 17 16:51:23 My-iPad Sec Sec[292] <Warning>: Incorrect NSStringEncoding value 0x0000 detected. Assuming NSASCIIStringEncoding. Will stop this compatiblity mapping behavior in the near future.
Jan 17 16:51:23 My-iPad Sec Sec[292] <Warning>: Incorrect NSStringEncoding value 0x0000 detected. Assuming NSASCIIStringEncoding. Will stop this compatiblity mapping behavior in the near future.
Jan 17 16:51:23 My-iPad Sec Sec[292] <Warning>: [ERROR] Worklight: -[WLClient onInvokeProcedureFailure:userInfo:]:696::response string=''
Jan 17 16:51:33 My-iPad Sec Sec[292] <Warning>: WLRequestBuilder.initWithRootUrl else_url: https://domain.com:443/MyApp/apps/services/api/MyApp/ipad/0/query
Jan 17 16:51:40 My-iPad Sec Sec[292] <Warning>: DeviceAuthManager:getWorklightUniqueDeviceId --> returning UUID from the keychain
Jan 17 16:51:40 My-iPad Sec Sec[292] <Warning>: WLRequestBuilder.initWithRootUrl else_url: https://domain.com:443/MyApp/apps/services/api/MyApp/ipad/0/query
在适配器XML文件中:

<procedure name="Authentication" requestTimeoutInSeconds="600000"/>  

我们用HTTP和HTTPS做了这个实验,但都有相同的问题(超时)

当我们启动应用程序时,我们获得了
wlclient init success

您的后端速度非常快,这很好,但这是一个内部系统

使用3G或WiFi时,速度通常很快。
当使用2G或更少时,速度通常要慢得多

您是否尝试增加
WL.Client.invokeProcess
以及适配器过程中的超时值

这将允许客户端和/或服务器等待响应的时间更长。这将有助于网络速度非常慢的情况

见以下问题:


不要在适配器XML文件中设置高超时。600.000秒超时意味着用于连接后端的线程将在超时前等待166.6小时,这很容易终止服务器功能:)

通常,您希望适配器备份超时为appadapter连接中允许的最高值。例如,如果您在应用程序中使用的最大超时为60秒,则这也是adapterbackend段中要使用的值


现在,关于appadapter细分市场。AFAIR默认超时为30秒。对于2G网络来说,这通常也足够了。然而,在某些情况下,这可能有点低。您可以使用getNetworkInfo()API()检测您是否使用WIFI/Mobile和3g/2g等。一旦您使用的是慢速网络,请增加超时时间。如果您的网络速度很快,没有理由让用户等待太久,请减少超时时间。

是的,我们已经尝试过这些方法,但没有任何用处。在做了这么多的研发和更改后,我们在Stackoverflow上发布了文章。这是什么意思?您尝试了什么设置?例如,您是否在InvokeProcess和procedure上都尝试了10分钟,但仍然失败?编辑问题并详细说明你做了哪些“实验”,因为你根本没有提到这一点。另外,你是否为了实验而尝试使用HTTP而不是HTTPS?有区别吗?哪项功能失效?这是登录吗?连接到服务器?一些数据检索程序?什么失败了?不管怎样,您都将获得wlclient init成功。这条消息是关于客户机框架而不是连接的,那么,还有什么失败了——到服务器的连接(这个“身份验证”功能是做什么的?)?您的服务器架构中是否有防火墙或任何其他服务器或任何东西?但如果是这种情况,同一应用程序在其他网络上工作的原因是什么。是的,我们有防火墙和其他服务器。
<procedure name="Authentication" requestTimeoutInSeconds="600000"/>