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 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?
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
}
});