<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Guruharish B</title>
    <description>The latest articles on DEV Community by Guruharish B (@guruharish_b).</description>
    <link>https://dev.to/guruharish_b</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3996004%2Fa6f520ef-fe19-4ee3-a693-cb71904db849.png</url>
      <title>DEV Community: Guruharish B</title>
      <link>https://dev.to/guruharish_b</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/guruharish_b"/>
    <language>en</language>
    <item>
      <title>Short polling ,Long polling And SSE</title>
      <dc:creator>Guruharish B</dc:creator>
      <pubDate>Mon, 22 Jun 2026 06:38:17 +0000</pubDate>
      <link>https://dev.to/guruharish_b/short-polling-long-polling-and-sse-20o5</link>
      <guid>https://dev.to/guruharish_b/short-polling-long-polling-and-sse-20o5</guid>
      <description>&lt;p&gt;&lt;strong&gt;Polling:&lt;/strong&gt;&lt;br&gt;
    Polling is the method in which client repeatedly checks server for new information&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Short polling:&lt;/strong&gt;&lt;br&gt;
    Short polling is the method in which client repeatedy checks server by sending request at regular interval of time to get new information&lt;/p&gt;

&lt;p&gt;Example (Customer, Chef, and Servant)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Imagine a customer orders food in a restaurant, the chef is preparing food (server),client is waiting for the order he/she placed(client) and servant act as communication channel(api).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In Short Polling, the customer repeatedly asks the servant &lt;strong&gt;(whether the food is ready?)(whether the food is ready?)&lt;/strong&gt; at regular interval of time(eg  5 seconds).&lt;br&gt;
The servant goes to the chef every time, checks the status, and returns with an update, even if the food is not ready.&lt;/p&gt;

&lt;p&gt;As the result, the customer keeps waiting and asking frequently.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Drawback:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Too many request&lt;/li&gt;
&lt;li&gt;Delayed updates(If the food becomes ready right after a poll, the customer must wait until the next polling interval to receive the update)&lt;/li&gt;
&lt;li&gt;Network overhead&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Long polling:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Long polling is the method in which the client sends a request to the server, and the server keeps the connection open until new data is available or a timeout occurs. The client also sets a timeout period for waiting for the response.&lt;/p&gt;

&lt;p&gt;Example (Customer, Chef, and Servant)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Imagine a customer orders food in a restaurant, the chef is preparing food (server),client is waiting for the order he/she placed(client) and servant act as communication channel(api).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In Long Polling, the customer asks the servant **(Tell me when my food is ready)&lt;br&gt;
**The servant goes to the chef and waits there.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If the chef finishes the food before the waiting time expires, the servant immediately returns and informs the customer.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If the chef does not finish the food within a certain time ,the servant says that the food is not read&lt;br&gt;
The customer then asks again:&lt;br&gt;
(Please let me know when it is ready)&lt;br&gt;
The servant goes back to the chef and waits again.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Drawback&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Connection timeout issues&lt;/li&gt;
&lt;li&gt;Open connection for a long time.&lt;/li&gt;
&lt;li&gt;The servant waits continuously, making it inefficient for many customers.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Server Sent Events (SSE)&lt;/strong&gt;&lt;br&gt;
  In Server-Sent Events (SSE), the client establishes a one way connection with the server and waits for updates. The server sends data to the client whenever new information becomes available, without requiring the client to repeatedly request updates.&lt;/p&gt;

&lt;p&gt;Example &lt;br&gt;
  In ,live stock prices client make an SSE connection then server keeps the connection open.Whenever a stock price changes, the server notify the info to the client.&lt;br&gt;
The client only receives data; it doesn't send messages through the SSE connection.(one way communication ie., server--&amp;gt; client)&lt;/p&gt;

</description>
      <category>api</category>
      <category>beginners</category>
      <category>systemdesign</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
