SlideShare a Scribd company logo
1 of 23
Client Polling vs Server Push vs Websocket vs Long Polling
Client Pull vs Server Push
Building a real-time web application is a bit challenging one, where we need to
consider how we are going to send our data from the server to the client.
Client pull — client asking server for updates at certain regular intervals
Server push — server is proactively pushing updates to the client (reverse of
pull)
Long Polling - client makes a request to the server, but this is kept open until a
"useful" response is returned. Problem with Long polling are empty responses,
wasting bandwidth and server resources.
The difference between push & pull technology is that when a client
initiates a request from the server, it’s called a pull, and when a
server sends the information to the client within any requests, it’s
called a push.
What is server push ?
Push Technology can be referred to as pushing the information from the server
without the client’s request. It’s the opposite of the traditional client/server model,
where clients need to request a server to push the information.
It’s used to share the pre-planned information to the client like news, weather, updates
and other information that clients have not requested, but servers push the information
based on the client’s activities. Push Technology is mainly used in business to share
time-sensitive information, commodity pricing, new program promotion, or
communicate with clients and employees.
Ex of Push – Email, Push Notification on mobile app etc.
Client Polling Mechanism
The basic idea is that the client repeatedly polls (or requests) a server for data.
The client makes a request and waits for the server to respond with data. If no
data is available, an empty response is returned. Pull Technology can be referred
to as communication between client & server. It’s a traditional way of
communication between client & server. Pull Technology is mainly used to drive the
content to many applications and devices; whenever a user browses, it implies a Pull
technology where a client pulls information from the server.
Client Polling Mechanism
1.The client opens a connection and requests data from the server using
regular HTTP.
2.The requested web page sends requests to the server at regular intervals
(e.g., 0.5 seconds).
3.The server calculates the response and sends it back, just like regular HTTP
traffic.
4.The client repeats the above three steps periodically to get updates from the
server.
Client Polling Mechanism
The problem with Polling is that the client has to keep asking the server for any
new data. As a result, a lot of responses are empty, creating HTTP overhead.
Pull Mechanism Push Mechanism
When a client requests the server for the information
called pull technology.
When a server updates the information to the client
without waiting for a request called push technology.
A user using a web browser and requesting for a
web page.
An email is immediately sent from the server to the
client.
Pull Technology is used when advertisers want to
reach global audiences or build a customer base.
Push Technology is used by online advertisements,
chat, email systems, security applications and RSS
feeds.
Long Polling Mechanism
•If the server does not have any data available for the client, instead of sending
an empty response, the server holds the request and waits until some data
becomes available.
•Once the data becomes available, a full response is sent to the client. The
client then immediately re-request information from the server so that the
server will almost always have an available waiting request that it can use to
deliver data in response to an event.
Long Polling Mechanism
1.The client makes an initial request using regular HTTP and then waits for a
response.
2.The server delays its response until an update is available or a timeout has
occurred.
3.When an update is available, the server sends a full response to the client.
4.The client typically sends a new long-poll request, either immediately upon
receiving a response or after a pause to allow an acceptable latency period.
5.Each Long-Poll request has a timeout. The client has to reconnect periodically
after the connection is closed due to timeouts.
Long Polling Mechanism drawback
1.Message ordering and delivery guarantees.
1.Message ordering cannot be guaranteed if the same client opens multiple
connections to the server.
2.If the client was not able to receive the message then there will be possible
message loss.
2.Performance and scaling.
3.Device support and fall backs.
What is Websocket ?
WebSocket is a computer communication protocol which provides full-
duplex communication channels over a single TCP connection.
•It is different from HTTP but compatible with HTTP.
•Located at layer 7 in the OSI model and depends on TCP at layer 4.
•Works over port 80 and 443 ( in case of TLS encrypted) and supports HTTP
proxies and intermediaries.
•To achieve compatibility, the WebSocket handshake uses Upgrade header to
update the protocol to the WebSocket protocol.
Websocket
WebSocket workflow
1.A client initiates a WebSocket handshake process by sending a request which
also contains Upgrade header to switch to WebSocket protocol along with
other information.
2.The server receives WebSocket handshake request and process it.
1.If the server can establish the connection and agrees with client terms then
sends a response to the client, acknowledging the WebSocket handshake
request with other information.
2.If the server can not establish the connection then it sends response
acknowledging it cannot establish WebSocket connection.
3.Once the client receives a successful WebSocket connection handshake
request, WebSocket connection will be opened. Now, client and servers can
start sending data in both directions allowing real-time communication.
4.The connection will be closed once the server or the client decides to close
the connection.
WebSocket Pros and Cons
Pros
•WebSockets keeps a unique connection open while eliminating latency problems
that arise with Long Polling.
•WebSockets generally do not use XMLHttpRequest, and as such, headers are not
sent every-time we need to get more information from the server. This, in turn,
reduces the expensive data loads being sent to the server.
Cons
•WebSockets don’t automatically recover when connections are terminated — this is
something you need to implement yourself, and is part of the reason why there are
many client-side libraries in existence.
•Browsers older than 2011 aren’t able to support WebSocket connections — but this
is increasingly less relevant.
WebSocket vs Long polling
Long polling is much more resource intensive on servers whereas WebSockets
have an extremely lightweight footprint on servers. Long polling also requires
many hops between servers and devices. And these gateways often have
different ideas of how long a typical connection is allowed to stay open. If it
stays open too long something may kill it, maybe even when it was doing
something important.
Why you should build with WebSockets:
•Full-duplex asynchronous messaging. In other words, both the client and the
server can stream messages to each other independently.
•WebSockets pass through most firewalls without any reconfiguration.
•Good security model (origin-based security model).
Server Push
Server-Sent Events are a one-way communication channel where events flow
from server to client only. Server-Sent Events allows browser clients to
receive a stream of events from a server over an HTTP connection without
polling.
A client subscribes to a “stream” from a server and the server will send
messages (“event-stream”) to the client until the server or the client closes the
stream. It is up to the server to decide when and what to send the client, for
instance as soon as data changes.
Server
Push
Server Push workflow
1.Browser client creates a connection using an EventSource API with a server
endpoint which is expected to return a stream of events over time. This
essentially makes an HTTP request at given URL.
2.The server receives a regular HTTP request from the client and opens the
connection and keeps it open. The server can now send the event data as long
as it wants or it can close the connection if there are no data.
3.The client receives each event from the server and process it. If it receives a
close signal from the server it can close the connection. The client can also
initiate the connection close request.
WebSocket vs Server Push
WebSockets are undoubtedly more complex and demanding than SSEs, and
require a bit of developer input up front. For this investment, you gain a full-
duplex TCP connection that is useful for a wider range of application scenarios.
For example WebSockets tend to be preferable for use cases such as multi-
player games or location-based apps. Where Serve Push can technically be
used to achieve these, this might cause the domain to get multiplexed.
WebSocket vs Server Push
WebSockets provide bidirectional client-server communication between clients and
servers. This kind of functionality is vastly applied and appreciated in technologies
technologies like real-time polling applications, chat applications, media players and
players and the like.
Server Push do not provide bidirectional communication. However, there are so
many applications where there’s no need to send data from the client. Cases like this
like this are updating statuses, push notifications, newsletters and news feeds. In
In scenarios like this, SSEs are most appreciated.
THANK YOU
Like the Video and Subscribe the Channel

More Related Content

What's hot

Kafka 101 and Developer Best Practices
Kafka 101 and Developer Best PracticesKafka 101 and Developer Best Practices
Kafka 101 and Developer Best Practicesconfluent
 
pfSense firewall workshop guide
pfSense firewall workshop guidepfSense firewall workshop guide
pfSense firewall workshop guideSopon Tumchota
 
Netflix: From Zero to Production-Ready in Minutes (QCon 2017)
Netflix: From Zero to Production-Ready in Minutes (QCon 2017)Netflix: From Zero to Production-Ready in Minutes (QCon 2017)
Netflix: From Zero to Production-Ready in Minutes (QCon 2017)Tim Bozarth
 
Open stack networking vlan, gre
Open stack networking   vlan, greOpen stack networking   vlan, gre
Open stack networking vlan, greSim Janghoon
 
Network time protocol
Network time protocolNetwork time protocol
Network time protocolMohd Amir
 
Event Driven Systems with Spring Boot, Spring Cloud Streams and Kafka
Event Driven Systems with Spring Boot, Spring Cloud Streams and KafkaEvent Driven Systems with Spring Boot, Spring Cloud Streams and Kafka
Event Driven Systems with Spring Boot, Spring Cloud Streams and KafkaVMware Tanzu
 
Ansible를 통한 컨테이너 환경 자동화
Ansible를 통한 컨테이너 환경 자동화Ansible를 통한 컨테이너 환경 자동화
Ansible를 통한 컨테이너 환경 자동화Opennaru, inc.
 
Introduction to MapReduce - Hadoop Streaming | Big Data Hadoop Spark Tutorial...
Introduction to MapReduce - Hadoop Streaming | Big Data Hadoop Spark Tutorial...Introduction to MapReduce - Hadoop Streaming | Big Data Hadoop Spark Tutorial...
Introduction to MapReduce - Hadoop Streaming | Big Data Hadoop Spark Tutorial...CloudxLab
 
Database ,11 Concurrency Control
Database ,11 Concurrency ControlDatabase ,11 Concurrency Control
Database ,11 Concurrency ControlAli Usman
 
Using AWS WAF and Lambda for Automatic Protection
Using AWS WAF and Lambda for Automatic ProtectionUsing AWS WAF and Lambda for Automatic Protection
Using AWS WAF and Lambda for Automatic ProtectionAmazon Web Services
 
Hypertext Transfer Protocol
Hypertext Transfer ProtocolHypertext Transfer Protocol
Hypertext Transfer ProtocolRajan Pandey
 
SDN & NFV Introduction - Open Source Data Center Networking
SDN & NFV Introduction - Open Source Data Center NetworkingSDN & NFV Introduction - Open Source Data Center Networking
SDN & NFV Introduction - Open Source Data Center NetworkingThomas Graf
 

What's hot (20)

Kafka 101 and Developer Best Practices
Kafka 101 and Developer Best PracticesKafka 101 and Developer Best Practices
Kafka 101 and Developer Best Practices
 
Nosql databases
Nosql databasesNosql databases
Nosql databases
 
NoSql
NoSqlNoSql
NoSql
 
Hadoop HDFS
Hadoop HDFSHadoop HDFS
Hadoop HDFS
 
pfSense firewall workshop guide
pfSense firewall workshop guidepfSense firewall workshop guide
pfSense firewall workshop guide
 
Netflix: From Zero to Production-Ready in Minutes (QCon 2017)
Netflix: From Zero to Production-Ready in Minutes (QCon 2017)Netflix: From Zero to Production-Ready in Minutes (QCon 2017)
Netflix: From Zero to Production-Ready in Minutes (QCon 2017)
 
Open stack networking vlan, gre
Open stack networking   vlan, greOpen stack networking   vlan, gre
Open stack networking vlan, gre
 
Pub/Sub Messaging
Pub/Sub MessagingPub/Sub Messaging
Pub/Sub Messaging
 
Network time protocol
Network time protocolNetwork time protocol
Network time protocol
 
Event Driven Systems with Spring Boot, Spring Cloud Streams and Kafka
Event Driven Systems with Spring Boot, Spring Cloud Streams and KafkaEvent Driven Systems with Spring Boot, Spring Cloud Streams and Kafka
Event Driven Systems with Spring Boot, Spring Cloud Streams and Kafka
 
HTTP
HTTPHTTP
HTTP
 
Ansible를 통한 컨테이너 환경 자동화
Ansible를 통한 컨테이너 환경 자동화Ansible를 통한 컨테이너 환경 자동화
Ansible를 통한 컨테이너 환경 자동화
 
Intro to HBase
Intro to HBaseIntro to HBase
Intro to HBase
 
Couchbase 101
Couchbase 101 Couchbase 101
Couchbase 101
 
Introduction to MapReduce - Hadoop Streaming | Big Data Hadoop Spark Tutorial...
Introduction to MapReduce - Hadoop Streaming | Big Data Hadoop Spark Tutorial...Introduction to MapReduce - Hadoop Streaming | Big Data Hadoop Spark Tutorial...
Introduction to MapReduce - Hadoop Streaming | Big Data Hadoop Spark Tutorial...
 
Http Protocol
Http ProtocolHttp Protocol
Http Protocol
 
Database ,11 Concurrency Control
Database ,11 Concurrency ControlDatabase ,11 Concurrency Control
Database ,11 Concurrency Control
 
Using AWS WAF and Lambda for Automatic Protection
Using AWS WAF and Lambda for Automatic ProtectionUsing AWS WAF and Lambda for Automatic Protection
Using AWS WAF and Lambda for Automatic Protection
 
Hypertext Transfer Protocol
Hypertext Transfer ProtocolHypertext Transfer Protocol
Hypertext Transfer Protocol
 
SDN & NFV Introduction - Open Source Data Center Networking
SDN & NFV Introduction - Open Source Data Center NetworkingSDN & NFV Introduction - Open Source Data Center Networking
SDN & NFV Introduction - Open Source Data Center Networking
 

Similar to Difference between Client Polling vs Server Push vs Websocket vs Long Polling

EAI design patterns/best practices
EAI design patterns/best practicesEAI design patterns/best practices
EAI design patterns/best practicesAjit Bhingarkar
 
What is a WebSocket? Real-Time Communication in Applications
What is a WebSocket? Real-Time Communication in ApplicationsWhat is a WebSocket? Real-Time Communication in Applications
What is a WebSocket? Real-Time Communication in ApplicationsInexture Solutions
 
05 20254 financial stock application
05 20254 financial stock application05 20254 financial stock application
05 20254 financial stock applicationIAESIJEECS
 
IRJET- An Overview of Web Sockets: The Future of Real-Time Communication
IRJET- An Overview of Web Sockets: The Future of Real-Time CommunicationIRJET- An Overview of Web Sockets: The Future of Real-Time Communication
IRJET- An Overview of Web Sockets: The Future of Real-Time CommunicationIRJET Journal
 
Web Technologies Notes - TutorialsDuniya.pdf
Web Technologies Notes - TutorialsDuniya.pdfWeb Technologies Notes - TutorialsDuniya.pdf
Web Technologies Notes - TutorialsDuniya.pdfRaghunathan52
 
Web Technologies Notes - TutorialsDuniya.pdf
Web Technologies Notes - TutorialsDuniya.pdfWeb Technologies Notes - TutorialsDuniya.pdf
Web Technologies Notes - TutorialsDuniya.pdfRaghunathan52
 
Taking a Quantum Leap with Html 5 WebSocket
Taking a Quantum Leap with Html 5 WebSocketTaking a Quantum Leap with Html 5 WebSocket
Taking a Quantum Leap with Html 5 WebSocketShahriar Hyder
 
Web Socket
Web SocketWeb Socket
Web SocketJack Bui
 
Building Realtime Web Applications With ASP.NET SignalR
Building Realtime Web Applications With ASP.NET SignalRBuilding Realtime Web Applications With ASP.NET SignalR
Building Realtime Web Applications With ASP.NET SignalRShravan Kumar Kasagoni
 
HTTP Request Smuggling
HTTP Request SmugglingHTTP Request Smuggling
HTTP Request SmugglingAkash Ashokan
 
Decoding real time web communication
Decoding real time web communicationDecoding real time web communication
Decoding real time web communicationAMiT JAiN
 

Similar to Difference between Client Polling vs Server Push vs Websocket vs Long Polling (20)

EAI design patterns/best practices
EAI design patterns/best practicesEAI design patterns/best practices
EAI design patterns/best practices
 
What is a WebSocket? Real-Time Communication in Applications
What is a WebSocket? Real-Time Communication in ApplicationsWhat is a WebSocket? Real-Time Communication in Applications
What is a WebSocket? Real-Time Communication in Applications
 
ClientServer Websocket.pptx
ClientServer Websocket.pptxClientServer Websocket.pptx
ClientServer Websocket.pptx
 
05 20254 financial stock application
05 20254 financial stock application05 20254 financial stock application
05 20254 financial stock application
 
IRJET- An Overview of Web Sockets: The Future of Real-Time Communication
IRJET- An Overview of Web Sockets: The Future of Real-Time CommunicationIRJET- An Overview of Web Sockets: The Future of Real-Time Communication
IRJET- An Overview of Web Sockets: The Future of Real-Time Communication
 
Real-time Communications with SignalR
Real-time Communications with SignalRReal-time Communications with SignalR
Real-time Communications with SignalR
 
Web Technologies Notes - TutorialsDuniya.pdf
Web Technologies Notes - TutorialsDuniya.pdfWeb Technologies Notes - TutorialsDuniya.pdf
Web Technologies Notes - TutorialsDuniya.pdf
 
Web Technologies Notes - TutorialsDuniya.pdf
Web Technologies Notes - TutorialsDuniya.pdfWeb Technologies Notes - TutorialsDuniya.pdf
Web Technologies Notes - TutorialsDuniya.pdf
 
Http_Protocol.pptx
Http_Protocol.pptxHttp_Protocol.pptx
Http_Protocol.pptx
 
Taking a Quantum Leap with Html 5 WebSocket
Taking a Quantum Leap with Html 5 WebSocketTaking a Quantum Leap with Html 5 WebSocket
Taking a Quantum Leap with Html 5 WebSocket
 
Web Socket
Web SocketWeb Socket
Web Socket
 
Building Realtime Web Applications With ASP.NET SignalR
Building Realtime Web Applications With ASP.NET SignalRBuilding Realtime Web Applications With ASP.NET SignalR
Building Realtime Web Applications With ASP.NET SignalR
 
Www and http
Www and httpWww and http
Www and http
 
Web server
Web serverWeb server
Web server
 
0130225347
01302253470130225347
0130225347
 
Java Networking
Java NetworkingJava Networking
Java Networking
 
Http smuggling 1 200523064027
Http smuggling 1 200523064027Http smuggling 1 200523064027
Http smuggling 1 200523064027
 
HTTP Request Smuggling
HTTP Request SmugglingHTTP Request Smuggling
HTTP Request Smuggling
 
1-1.pdf
1-1.pdf1-1.pdf
1-1.pdf
 
Decoding real time web communication
Decoding real time web communicationDecoding real time web communication
Decoding real time web communication
 

More from jeetendra mandal

Eventual consistency vs Strong consistency what is the difference
Eventual consistency vs Strong consistency what is the differenceEventual consistency vs Strong consistency what is the difference
Eventual consistency vs Strong consistency what is the differencejeetendra mandal
 
Batch Processing vs Stream Processing Difference
Batch Processing vs Stream Processing DifferenceBatch Processing vs Stream Processing Difference
Batch Processing vs Stream Processing Differencejeetendra mandal
 
Difference between Database vs Data Warehouse vs Data Lake
Difference between Database vs Data Warehouse vs Data LakeDifference between Database vs Data Warehouse vs Data Lake
Difference between Database vs Data Warehouse vs Data Lakejeetendra mandal
 
Difference between TLS 1.2 vs TLS 1.3 and tutorial of TLS2 and TLS2 version c...
Difference between TLS 1.2 vs TLS 1.3 and tutorial of TLS2 and TLS2 version c...Difference between TLS 1.2 vs TLS 1.3 and tutorial of TLS2 and TLS2 version c...
Difference between TLS 1.2 vs TLS 1.3 and tutorial of TLS2 and TLS2 version c...jeetendra mandal
 
Difference Program vs Process vs Thread
Difference Program vs Process vs ThreadDifference Program vs Process vs Thread
Difference Program vs Process vs Threadjeetendra mandal
 
Carrier Advice for a JAVA Developer How to Become a Java Programmer
Carrier Advice for a JAVA Developer How to Become a Java ProgrammerCarrier Advice for a JAVA Developer How to Become a Java Programmer
Carrier Advice for a JAVA Developer How to Become a Java Programmerjeetendra mandal
 
How to become a Software Tester Carrier Path for Software Quality Tester
How to become a Software Tester Carrier Path for Software Quality TesterHow to become a Software Tester Carrier Path for Software Quality Tester
How to become a Software Tester Carrier Path for Software Quality Testerjeetendra mandal
 
How to become a Software Engineer Carrier Path for Software Developer
How to become a Software Engineer Carrier Path for Software DeveloperHow to become a Software Engineer Carrier Path for Software Developer
How to become a Software Engineer Carrier Path for Software Developerjeetendra mandal
 
Microservice Architecture Software Architecture Microservice Design Pattern
Microservice Architecture Software Architecture Microservice Design PatternMicroservice Architecture Software Architecture Microservice Design Pattern
Microservice Architecture Software Architecture Microservice Design Patternjeetendra mandal
 
Event Driven Software Architecture Pattern
Event Driven Software Architecture PatternEvent Driven Software Architecture Pattern
Event Driven Software Architecture Patternjeetendra mandal
 
Top 5 Software Architecture Pattern Event Driven SOA Microservice Serverless ...
Top 5 Software Architecture Pattern Event Driven SOA Microservice Serverless ...Top 5 Software Architecture Pattern Event Driven SOA Microservice Serverless ...
Top 5 Software Architecture Pattern Event Driven SOA Microservice Serverless ...jeetendra mandal
 
Observability vs APM vs Monitoring Comparison
Observability vs APM vs  Monitoring ComparisonObservability vs APM vs  Monitoring Comparison
Observability vs APM vs Monitoring Comparisonjeetendra mandal
 
Disaster Recovery vs Data Backup what is the difference
Disaster Recovery vs Data Backup what is the differenceDisaster Recovery vs Data Backup what is the difference
Disaster Recovery vs Data Backup what is the differencejeetendra mandal
 
What is Spinnaker? Spinnaker tutorial
What is Spinnaker? Spinnaker tutorialWhat is Spinnaker? Spinnaker tutorial
What is Spinnaker? Spinnaker tutorialjeetendra mandal
 
Difference between Github vs Gitlab vs Bitbucket
Difference between Github vs Gitlab vs BitbucketDifference between Github vs Gitlab vs Bitbucket
Difference between Github vs Gitlab vs Bitbucketjeetendra mandal
 
Difference between Git and Github
Difference between Git and GithubDifference between Git and Github
Difference between Git and Githubjeetendra mandal
 

More from jeetendra mandal (20)

what is OSI model
what is OSI modelwhat is OSI model
what is OSI model
 
What is AWS Cloud Watch
What is AWS Cloud WatchWhat is AWS Cloud Watch
What is AWS Cloud Watch
 
What is AWS Fargate
What is AWS FargateWhat is AWS Fargate
What is AWS Fargate
 
Eventual consistency vs Strong consistency what is the difference
Eventual consistency vs Strong consistency what is the differenceEventual consistency vs Strong consistency what is the difference
Eventual consistency vs Strong consistency what is the difference
 
Batch Processing vs Stream Processing Difference
Batch Processing vs Stream Processing DifferenceBatch Processing vs Stream Processing Difference
Batch Processing vs Stream Processing Difference
 
Difference between Database vs Data Warehouse vs Data Lake
Difference between Database vs Data Warehouse vs Data LakeDifference between Database vs Data Warehouse vs Data Lake
Difference between Database vs Data Warehouse vs Data Lake
 
Difference between TLS 1.2 vs TLS 1.3 and tutorial of TLS2 and TLS2 version c...
Difference between TLS 1.2 vs TLS 1.3 and tutorial of TLS2 and TLS2 version c...Difference between TLS 1.2 vs TLS 1.3 and tutorial of TLS2 and TLS2 version c...
Difference between TLS 1.2 vs TLS 1.3 and tutorial of TLS2 and TLS2 version c...
 
Difference Program vs Process vs Thread
Difference Program vs Process vs ThreadDifference Program vs Process vs Thread
Difference Program vs Process vs Thread
 
Carrier Advice for a JAVA Developer How to Become a Java Programmer
Carrier Advice for a JAVA Developer How to Become a Java ProgrammerCarrier Advice for a JAVA Developer How to Become a Java Programmer
Carrier Advice for a JAVA Developer How to Become a Java Programmer
 
How to become a Software Tester Carrier Path for Software Quality Tester
How to become a Software Tester Carrier Path for Software Quality TesterHow to become a Software Tester Carrier Path for Software Quality Tester
How to become a Software Tester Carrier Path for Software Quality Tester
 
How to become a Software Engineer Carrier Path for Software Developer
How to become a Software Engineer Carrier Path for Software DeveloperHow to become a Software Engineer Carrier Path for Software Developer
How to become a Software Engineer Carrier Path for Software Developer
 
Events vs Notifications
Events vs NotificationsEvents vs Notifications
Events vs Notifications
 
Microservice Architecture Software Architecture Microservice Design Pattern
Microservice Architecture Software Architecture Microservice Design PatternMicroservice Architecture Software Architecture Microservice Design Pattern
Microservice Architecture Software Architecture Microservice Design Pattern
 
Event Driven Software Architecture Pattern
Event Driven Software Architecture PatternEvent Driven Software Architecture Pattern
Event Driven Software Architecture Pattern
 
Top 5 Software Architecture Pattern Event Driven SOA Microservice Serverless ...
Top 5 Software Architecture Pattern Event Driven SOA Microservice Serverless ...Top 5 Software Architecture Pattern Event Driven SOA Microservice Serverless ...
Top 5 Software Architecture Pattern Event Driven SOA Microservice Serverless ...
 
Observability vs APM vs Monitoring Comparison
Observability vs APM vs  Monitoring ComparisonObservability vs APM vs  Monitoring Comparison
Observability vs APM vs Monitoring Comparison
 
Disaster Recovery vs Data Backup what is the difference
Disaster Recovery vs Data Backup what is the differenceDisaster Recovery vs Data Backup what is the difference
Disaster Recovery vs Data Backup what is the difference
 
What is Spinnaker? Spinnaker tutorial
What is Spinnaker? Spinnaker tutorialWhat is Spinnaker? Spinnaker tutorial
What is Spinnaker? Spinnaker tutorial
 
Difference between Github vs Gitlab vs Bitbucket
Difference between Github vs Gitlab vs BitbucketDifference between Github vs Gitlab vs Bitbucket
Difference between Github vs Gitlab vs Bitbucket
 
Difference between Git and Github
Difference between Git and GithubDifference between Git and Github
Difference between Git and Github
 

Recently uploaded

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....ShaimaaMohamedGalal
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 

Recently uploaded (20)

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 

Difference between Client Polling vs Server Push vs Websocket vs Long Polling

  • 1. Client Polling vs Server Push vs Websocket vs Long Polling
  • 2. Client Pull vs Server Push Building a real-time web application is a bit challenging one, where we need to consider how we are going to send our data from the server to the client. Client pull — client asking server for updates at certain regular intervals Server push — server is proactively pushing updates to the client (reverse of pull) Long Polling - client makes a request to the server, but this is kept open until a "useful" response is returned. Problem with Long polling are empty responses, wasting bandwidth and server resources.
  • 3. The difference between push & pull technology is that when a client initiates a request from the server, it’s called a pull, and when a server sends the information to the client within any requests, it’s called a push.
  • 4. What is server push ? Push Technology can be referred to as pushing the information from the server without the client’s request. It’s the opposite of the traditional client/server model, where clients need to request a server to push the information. It’s used to share the pre-planned information to the client like news, weather, updates and other information that clients have not requested, but servers push the information based on the client’s activities. Push Technology is mainly used in business to share time-sensitive information, commodity pricing, new program promotion, or communicate with clients and employees. Ex of Push – Email, Push Notification on mobile app etc.
  • 5.
  • 6. Client Polling Mechanism The basic idea is that the client repeatedly polls (or requests) a server for data. The client makes a request and waits for the server to respond with data. If no data is available, an empty response is returned. Pull Technology can be referred to as communication between client & server. It’s a traditional way of communication between client & server. Pull Technology is mainly used to drive the content to many applications and devices; whenever a user browses, it implies a Pull technology where a client pulls information from the server.
  • 7. Client Polling Mechanism 1.The client opens a connection and requests data from the server using regular HTTP. 2.The requested web page sends requests to the server at regular intervals (e.g., 0.5 seconds). 3.The server calculates the response and sends it back, just like regular HTTP traffic. 4.The client repeats the above three steps periodically to get updates from the server.
  • 8. Client Polling Mechanism The problem with Polling is that the client has to keep asking the server for any new data. As a result, a lot of responses are empty, creating HTTP overhead.
  • 9. Pull Mechanism Push Mechanism When a client requests the server for the information called pull technology. When a server updates the information to the client without waiting for a request called push technology. A user using a web browser and requesting for a web page. An email is immediately sent from the server to the client. Pull Technology is used when advertisers want to reach global audiences or build a customer base. Push Technology is used by online advertisements, chat, email systems, security applications and RSS feeds.
  • 10. Long Polling Mechanism •If the server does not have any data available for the client, instead of sending an empty response, the server holds the request and waits until some data becomes available. •Once the data becomes available, a full response is sent to the client. The client then immediately re-request information from the server so that the server will almost always have an available waiting request that it can use to deliver data in response to an event.
  • 11. Long Polling Mechanism 1.The client makes an initial request using regular HTTP and then waits for a response. 2.The server delays its response until an update is available or a timeout has occurred. 3.When an update is available, the server sends a full response to the client. 4.The client typically sends a new long-poll request, either immediately upon receiving a response or after a pause to allow an acceptable latency period. 5.Each Long-Poll request has a timeout. The client has to reconnect periodically after the connection is closed due to timeouts.
  • 12. Long Polling Mechanism drawback 1.Message ordering and delivery guarantees. 1.Message ordering cannot be guaranteed if the same client opens multiple connections to the server. 2.If the client was not able to receive the message then there will be possible message loss. 2.Performance and scaling. 3.Device support and fall backs.
  • 13. What is Websocket ? WebSocket is a computer communication protocol which provides full- duplex communication channels over a single TCP connection. •It is different from HTTP but compatible with HTTP. •Located at layer 7 in the OSI model and depends on TCP at layer 4. •Works over port 80 and 443 ( in case of TLS encrypted) and supports HTTP proxies and intermediaries. •To achieve compatibility, the WebSocket handshake uses Upgrade header to update the protocol to the WebSocket protocol.
  • 15. WebSocket workflow 1.A client initiates a WebSocket handshake process by sending a request which also contains Upgrade header to switch to WebSocket protocol along with other information. 2.The server receives WebSocket handshake request and process it. 1.If the server can establish the connection and agrees with client terms then sends a response to the client, acknowledging the WebSocket handshake request with other information. 2.If the server can not establish the connection then it sends response acknowledging it cannot establish WebSocket connection. 3.Once the client receives a successful WebSocket connection handshake request, WebSocket connection will be opened. Now, client and servers can start sending data in both directions allowing real-time communication. 4.The connection will be closed once the server or the client decides to close the connection.
  • 16. WebSocket Pros and Cons Pros •WebSockets keeps a unique connection open while eliminating latency problems that arise with Long Polling. •WebSockets generally do not use XMLHttpRequest, and as such, headers are not sent every-time we need to get more information from the server. This, in turn, reduces the expensive data loads being sent to the server. Cons •WebSockets don’t automatically recover when connections are terminated — this is something you need to implement yourself, and is part of the reason why there are many client-side libraries in existence. •Browsers older than 2011 aren’t able to support WebSocket connections — but this is increasingly less relevant.
  • 17. WebSocket vs Long polling Long polling is much more resource intensive on servers whereas WebSockets have an extremely lightweight footprint on servers. Long polling also requires many hops between servers and devices. And these gateways often have different ideas of how long a typical connection is allowed to stay open. If it stays open too long something may kill it, maybe even when it was doing something important. Why you should build with WebSockets: •Full-duplex asynchronous messaging. In other words, both the client and the server can stream messages to each other independently. •WebSockets pass through most firewalls without any reconfiguration. •Good security model (origin-based security model).
  • 18. Server Push Server-Sent Events are a one-way communication channel where events flow from server to client only. Server-Sent Events allows browser clients to receive a stream of events from a server over an HTTP connection without polling. A client subscribes to a “stream” from a server and the server will send messages (“event-stream”) to the client until the server or the client closes the stream. It is up to the server to decide when and what to send the client, for instance as soon as data changes.
  • 20. Server Push workflow 1.Browser client creates a connection using an EventSource API with a server endpoint which is expected to return a stream of events over time. This essentially makes an HTTP request at given URL. 2.The server receives a regular HTTP request from the client and opens the connection and keeps it open. The server can now send the event data as long as it wants or it can close the connection if there are no data. 3.The client receives each event from the server and process it. If it receives a close signal from the server it can close the connection. The client can also initiate the connection close request.
  • 21. WebSocket vs Server Push WebSockets are undoubtedly more complex and demanding than SSEs, and require a bit of developer input up front. For this investment, you gain a full- duplex TCP connection that is useful for a wider range of application scenarios. For example WebSockets tend to be preferable for use cases such as multi- player games or location-based apps. Where Serve Push can technically be used to achieve these, this might cause the domain to get multiplexed.
  • 22. WebSocket vs Server Push WebSockets provide bidirectional client-server communication between clients and servers. This kind of functionality is vastly applied and appreciated in technologies technologies like real-time polling applications, chat applications, media players and players and the like. Server Push do not provide bidirectional communication. However, there are so many applications where there’s no need to send data from the client. Cases like this like this are updating statuses, push notifications, newsletters and news feeds. In In scenarios like this, SSEs are most appreciated.
  • 23. THANK YOU Like the Video and Subscribe the Channel