Before explaining in detail how Bigpipe works, I will mention I developed a Django extension that implements Bigpipe. Bigpipe-Response.
I will use Bigpipe-Response code to illustrate how Bigpipe works.
Bigpipe is using the initial connection made by the browser, in the following steps:
- The browser will open an HTTP connection and will request a WEB page.
The server will send back the HTML.
a. Without closing </BODY></HTML>
tags. This way to browser assumes that the connection is still open.
b. The HTML will contain empty <DIV id="pagelet-1"></DIV>
elements where bigpipe fill a pagelet content.
c. Small javascript at the top of the page is included (see step 3)
At the top of the page, there is a small javascript function that accepts JSON and populates the page with that JSON content. bigpipe.js
- While the connection is still open the server will open requests internally to all pagelets. here
- When a response from a pagelet is available the server will wrap the response data in a JSON (this includes JS, CSS, i18n, links, etc...). and will send it as a parameter for a javascript function call. see here
- the function
renderPagelet
inside the Bigpipe.js
file will use the JSON data to populate the HTML page.
- When all pagelets are served, the server will send closing
</BODY></HTML>
tags.
- The HTTP connection will be closed here
Hope this helps.
for more info, you can refer to the documentation Here.