While reading about Google webtool kit, came across a statement saying ‘synchronous RPCs are bad’. Any reason why they are? One good reason i could think of is the response to end user may be impacted by any lag in the remote server or due to networking issues.
Can anyone tell what the exact reasons are?
Thank you all in advance.
I guess GWT is talking about synchronous RPC from the javascript code running in the browser to the server. And it’s indeed bad, because JavaScript is single-threaded, and doing a lengthy synchronous RPC call from the JavaScript thread makes the browser page not responsive: the GUI is frozen until the RPC call ends.
That’s why AJAX is asynchronous by default: it allows making asynchronous requests to the server, which lets the browser in a responsive state. When the response comes back, a callback method is called to handle the result.