Today topic I learnt A developer explains server-sent events (SSE), long polling, and short polling as techniques for real-time data delivery, using ChatGPT's streaming output as an example of SSE in action. Hello Today I have learnt about Server-side event, Long polling, short polling and going to discuss it here. Introduction: Assume you are using ChatGPT and sent a query to the LLM and it's making you to wait for some seconds before printing the entire answer in a one shot action like loading a webpage instead of the current sequential character printing the pattern, will it be frustrating by make you feel like waiting? so to prevent the user from feeling the pain to waiting most LLMs uses the sequential printing method. Server-side event: Server side rendering is the practice of rendering web pages from the server and delivering the rendered HTML to the client. Without SSE: The order is placed; then the waiter vanishes. The waiter returns after 20 minutes with the full course meal. Order → Wait silently → Meal arrives With SSE: The order is placed, followed by constant updates from the waiter: "Chefs have started preparing the food." "The drink or juice has been served." "Preparing the main course." "Meals on their way " There is no need to ask for updates. The waiter provides them on his own accord. How ChatGPT-like streaming uses SSE: When you send: "Explain black holes.", The browser opens an SSE connection. Then the server begins to generate: Black holes are regions of space... And does not wait until it finishes generating the answer but sends it immediately: Server → "Black" Server → " holes" Server → " are" Server → " regions" ... Each item is appended to the web page by the application in order to make the typical effect of typing. Short Polling: The client will keep on polling the server for data irrespective of the availability of data. Example: A chat application can check for any new messages every 3 seconds. Client ---- "Are there any new messages?" Server ---- "No." 3 seconds later Client ---- "Are there any new messages?" Server ---- "Yes, there are 2 messages." Long Polling: The client sends a request and waits. The server will keep on holding the request open till new data is available and responds Example: Client --- "Are there any new messages?" Server --- waits... A message comes Server --- "Yes, here is the message" Client --- "Are there any other messages?" Server --- waits...