Page 1 of 1

HTTP Plugin Timeout

PostPosted: Sun Mar 05, 2017 1:04 am
by kwpsd
Servoy 7.4.9

We are using the http plugin to interface to a RFID system. For http post requests, what is the best way to handle timeouts? That is, how do we detect that the RFID system has not responded in a given amount of time. Also, we discovered that the .setTimeout() function for the http plugin has been deprecated, so how is the timeout value set? There is very limited information in the wiki for the http plugin. Help, please!

Re: HTTP Plugin Timeout

PostPosted: Wed Mar 08, 2017 11:50 pm
by kwpsd
Doing some emprical testing with the http plugin, we discovered that the timeout default is approximately 20 seconds. How do we change the default timeout setting? Can it be changed, or is it fixed at 20 seconds? Anyone know?


To help others...

When the far end server does not respond to a plugin http post request and a timeout condition occurs, the http plugin response object returns a http status code of zero.

Code: Select all
e.g. httpResponse.getStatusCode()


Although a http status code of zero is not defined in the IETF/IANA registry/specification, it can be used to detect when the far end server is 'unreachable'.

https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml

@Servoy: Please consider putting this information in the wiki.

Re: HTTP Plugin Timeout

PostPosted: Thu Mar 09, 2017 4:07 am
by sbutler
Looks like the setTimeout is in the HttpClient object you get from createNewHttpClient

https://wiki.servoy.com/display/Serv7/H ... setTimeout

Re: HTTP Plugin Timeout

PostPosted: Thu Mar 09, 2017 7:20 pm
by kwpsd
Thanks, Scott. I tried setting the http timeout again today, and, now I am not getting the deprecated method message and the .setTimeout() does not have the strike-through. I should have taken a screen shot when it happened.

Re: HTTP Plugin Timeout

PostPosted: Thu Mar 09, 2017 9:40 pm
by sbutler
I think at one point, it used to be under plugins.http.setTimeout, and that was deprecated, so now its in the HttpClient object that you get back from plugins.http.createNewHttpClient. so they probably just moved it.

Re: HTTP Plugin Timeout

PostPosted: Thu Mar 09, 2017 11:45 pm
by kwpsd
Thank you, Scott, for the explanation. You are correct...I was using the old style of code. And, the move makes sense as you can set the timeout for individual clients, not just the for plugin.