Page 1 of 1

HTTP Request - timeout

Posted: 15 Feb 2017 14:11
by pko
Hello,

I just started developing modules for Z-Way Server.

As the first module should provide some notification functionality, it is necessary to send a POST request via HTTP (using http.request()). Unfortunately, http.request() function seems to have only 5000 ms timeout, which is not enough for my purpose (response time from server is about 7 s). I already tried using timeout parameter (ajax syntax) without any success. Is there a way to set longer timeout?

Thank you :)

Re: HTTP Request - timeout

Posted: 17 Feb 2017 03:10
by PoltoS
Please use timeout key in the object passed to http.request(). BTW, 20000 ms is the default in the code

Re: HTTP Request - timeout

Posted: 17 Feb 2017 10:47
by pko
Thank you for your response. I already tried using timeout key without any success. The request still returns an error after 5 seconds with status text "Timeout was reached". If the default timeout is 20000 ms, is there any other reason why I am getting that error?

Thank you in advance

Re: HTTP Request - timeout

Posted: 24 Feb 2017 18:10
by pko
Problem solved after upgrading firmware from v2.2.4 to v2.3.0.

Re: HTTP Request - timeout

Posted: 28 Feb 2017 17:47
by nico_syspert
I'm using V2.3.0 but still I get a timeout after 5 seconds.

If I use
timeout : 20 or
timeout : 4000

they all work

But specifying a timeout over 5000 keeps coming back after 5 seconds.

http.request({
url: 'sip/ps/alertzwave.php?device=' + encodeURI(devName) + '&level=' + lvl + '&message=alarm',
async: true,
timeout: 3000,
error: function(response) {
console.log("Can not make request: " + response.statusText); // don't add it to notifications, since it will fill all the notifcations on error
self.controller.addNotification('device-info sensor', msg , msgType, devId);
},
auth: {
login: config.user,
password: config.password
}
});

Re: HTTP Request - timeout

Posted: 03 Mar 2017 04:47
by PoltoS
you mean you specify timeout > 5000 seconds? What is the reason for that?