diff --git a/Chapter_8_Replacing_HTTP_With_WebSockets.asciidoc b/Chapter_8_Replacing_HTTP_With_WebSockets.asciidoc index 3cd2bf06..cb8a5aff 100644 --- a/Chapter_8_Replacing_HTTP_With_WebSockets.asciidoc +++ b/Chapter_8_Replacing_HTTP_With_WebSockets.asciidoc @@ -25,7 +25,7 @@ The HTTP protocol is the lingua franca of today's Web applications, where clien With _short polling_, your client code sends requests to the server every N seconds. The response is «empty» if there is no update as illustrated in Figure 8-1. Visualize a child seating on back seat of your car and asking, "Are we where?" every minute. And you're politely replying "Not just yet" - compare it to a empty server response. There is no valuable payload for this kid, but she's still receiving some "metadata". HTTP polling does the same thing that generates verbose HTTP response headers sending empty payload. Let alone destructing the driver (think the server) from performing other responsibilities. -image:fig_08_01.png[image] +image:images/fig_08_01.png[image] Figure 8-1 Short polling @@ -37,7 +37,7 @@ We'll give you one more analogy to compare short and long polling. Imagine a par From HTTP specification perspective this "hack" is legit: long polling server behavior indistinguishable from the «slow» server. That is why this technique also referred as "Hanging GET". If you see an online auction that automatically modifies the prices as people bid on the item it looks as if the server pushes the data to you. But most likely, this functionality was implemented using long polling, which is not a real server-side data push, but its emulation. -image:fig_08_02.png[image] +image:images/fig_08_02.png[image] Figure 8-2 Long polling @@ -47,7 +47,7 @@ TODO Compare pros and cons of long vs short polling Client sends the request, server wait for events and streams +multipart/chunked+ response, and then waits for the events. The server pushes the data to the client pretending that the response never ends. The response is continually appended by the server, usually with `