educative.io

Persistent connection

Please explain how persistent connection is maintained between client and server using heartbeat interceptor. The explanation is not in detail over here.


Course: Web Application and Software Architecture 101 - Learn Interactively
Lesson: HTTP Push - Web Application and Software Architecture 101

Hello @NIKHIL_ANAND
As we know, " A persistent connection is a network connection between the client and the server that remains open for future requests and responses, as opposed to being closed after a single communication."
How to maintain the client and server persistent connection with the heartbeat? Heartbeat is blank requests between client and author.
Suppose every connection is automatically closed after 10 seconds. We keep the connection persistent by sending a blank request every 9.5 seconds. The connection will stay open for the next 10 seconds and repeat, sending a heartbeat after 9.5 seconds making it a persistent connection.

I hope it will help.
Happy Learning.