2014-01-17 47 views
0

我們已經使用Worklight 6.1iOS5,iOS6 & IOS7構建了一個應用程序,它的工作狀態非常好。IBM Worklight 6.1 - 如何處理較慢網絡中的超時?

但是,當我們試圖在2G網絡中嘗試使用應用程序並嘗試調用適配器過程時,它甚至未連接到服務器。每次嘗試10-15次時,我們都會得到一個超時時間,它會連接到服務器並給予迴應。

當我們在其他良好的網絡或3G上使用相同的應用程序時,它沒有問題就很好地工作。

這是日誌這在Xcode管理控制檯,我們本身在使用2G網絡:

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 

讓我知道會有怎樣的問題,還有什麼我們能爲它做的。我們的後端API非常快,在毫秒內我們得到了迴應。

我們確實在程序方面內容:

var timeout = 600000; 
var invocationOptions = { 
    onSuccess: LoginSuccess, 
    onFailure: LoginFail, 
    timeout: timeout 
}; 

而且在適配器XML文件:

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

我們已經嘗試過這種實驗,HTTP和HTTPS都和有同樣的問題(獲取時間出)。

當我們啓動應用程序時,我們得到wlclient init success

回答

0

很好,你的後端是非常快,但這是一個內部系統。

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

是否嘗試增加WL.Client.invokeProcedure以及適配器過程中的超時值?

這些將允許客戶端和/或服務器等待更長的響應時間。這應該有助於網絡速度非常慢的情況。

看到這些問題:

+0

是的,我們已經嘗試過這些東西,但沒有用。在做了如此多的研發和變更後,我們在Stackoverflow上發佈。 –

+0

這是什麼意思?你嘗試過什麼設置?你有沒有嘗試例如10分鐘的invokeProcedure和程序,但它仍然失敗?編輯問題並詳細說明你所做的「實驗」,因爲你根本沒有提到這一點。 –

+0

另外,你是否嘗試了HTTP而不是HTTPS的實驗?有區別嗎?哪個功能失敗?這是登錄嗎?連接到服務器?一些數據檢索程序?什麼失敗? –

1

不要將適配器XML文件中高超時。 600.000秒的超時時間意味着用於連接後端的線程在超時前等待166.6小時,這可以輕鬆地終止您的服務器功能:)

通常,您希望您的適配器< - >後端超時時間爲您在應用< - >適配器連接中允許的最高值。例如。如果您在應用程序中使用的最大超時時間爲60秒 - 這也是適配器< - >後端段中使用的值。

現在,關於應用程序< - >適配器段。 AFAIR默認超時時間爲30秒。對於2G網絡來說,這通常也足夠了。但是在某些情況下,這可能有點低。您可以使用getNetworkInfo()API(http://pic.dhe.ibm.com/infocenter/wrklight/v6r1m0/index.jsp?topic=%2Fcom.ibm.worklight.apiref.doc%2Fhtml%2Frefjavascript-client%2Fhtml%2FWL.Device.html)來檢測您是否使用WIFI/Mobile和3G/2G等。一旦您在慢速網絡上 - 增加超時。如果你的網絡速度很快 - 沒有理由讓用戶等待太久,減少你的超時時間。

相關問題