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
HTTP Request - timeout
Re: HTTP Request - timeout
Please use timeout key in the object passed to http.request(). BTW, 20000 ms is the default in the code
Re: HTTP Request - timeout
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
Thank you in advance
Re: HTTP Request - timeout
Problem solved after upgrading firmware from v2.2.4 to v2.3.0.
-
- Posts: 1
- Joined: 28 Feb 2017 17:43
Re: HTTP Request - timeout
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
}
});
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
you mean you specify timeout > 5000 seconds? What is the reason for that?