As shown in the figure, the client page needs the data of these two interfaces.
After I obtained these two data separately
Upon completion of the interface
Interface 2 completed
However, the page seen by the client will not be rendered until the final interface is completed.
May I know where the problem lies?
In fact, after receiving the data, js implemented a method similar to innerHTML.
After res.write data, the res.end method needs to be called. The server can only think that the data has been written and the client can only receive the written signal and read the data.
In front of the 7788 phase of course answered, sorry
I ran the code using the example I found.
pay attention to
[KEYCODE]The code at should ensure that the main page to be displayed is larger than 1K? Not sure, it’s bigger anyway.
It seems to be a problem with the browser’s cache.
When it is found that the response header has a Transfer-Encoding:chunked and there is no Content-Length header (both cannot coexist), when it is found that the received content is less than a certain set value, it will continue to wait for the subsequent content without parsing immediately.
Firefox and safari use the above methods ~ ~
Chrome, however, is very active, processing the content as soon as it is received ~ ~ ~