I wander how do client side get response if the connection of request is not finished yet?
What's the principle?
In fact I've read quite a few posts on this subject:
How do I implement basic "Long Polling"?
How does the live, real-time typing w开发者_运维问答ork in Google Wave?
But none of them solve my doubt
The answer depends on the technique used.
HTTP streaming, using the "hidden Iframe" technique, can do this. The technique is that the server sends <script>
elements to the hidden iframe. Each script element will contain some executable JavaScript. This technique relies on the fact that browsers generally interpret an HTML element as soon as it is loaded. In this way, there is no need for any sort of polling code in the client; the script tags will contain the appropriate function calls, and the browser will execute those calls as soon as the script element is completely loaded.
精彩评论