How do we know that timeout has occurred and handle it?

This thread was migrated from an old forum. It may contain information that are no longer valid. For further assistance, please post a new question or open a support ticket from the Customer Support portal.

I am using kony.net.HttpRequest() API and timeout is set to 20000 ,

How to handle if any service request is time outs . do we get any callback for it.

code snippet .

var httpclient = new kony.net.HttpRequest();

httpclient.timeout = 20000;

Thank you.

Hi @Chvwlize Hewwing​ , There is no callback available to handle service request time outs. You need to implement own logic to handle the timeout.

@Chvwlize Hewwing​ ., you may use this code snippet

function invokeHTTPRequest() { var httpclient = new kony.net.HttpRequest(); httpclient.open(constants.HTTP_METHOD_POST, "<url>" ); httpclient.setRequestHeader("Content-type","application/x-www-form-urlencoded"); httpclient.timeout = 20000; httpclient.onReadyStateChange = function(result){ var readyState = Number(httpclient.readyState.toString()); if(readyState === 4 ){ if(result.response === "" || result.response === null){ alert("call failed"); } } }; httpclient.send(); }

When the readyState is 4 and response is null or empty, you can handle the timeout.

@Bewnvdette Hvwdvcwe​ - Where this code snippet actually supposed to go, we're looking for a global setting in the client calls to Fabric, so the application is not stuck for long time for not getting response on time ?