timeout for async http request only, why ?
Why can I not specify a timeout for synchronous request also ?
This is in my opinion a serious design flaw.
All the world and his brother is touting to stay away from
synchronous request but....
When a user is working with a database via synchronous requests
he can be sure the transaction is complete, or he
receives a message from the database that something is wrong
so the user can decide,depending on the responds, how and if to carry on with his work.
In fact there are situations when I have to block the user from interacting
with the web application until the back end has responded somehow.
That is why I prefer using synchronous requests, here blocking comes for
However, I ran in situations where the back end did not respond for
whatever reason, so the web application is blocked forever, as well as the user.
Here it would make perfect sense to be able to specify a timeout and
a function for the ontimeout-event. Then I could say , that if the
back end is not responding within 100ms my ontimeout-event starts working
by alerting the user and I kill the pending request.
Meanwhile i have an ugly solution by using async requests, some homegrown
modal dialogs to block interaction with the web application and setTimout() and clearTimout().
So please educate me why this has to be like it is.