Client-Server Communication Protocols
Understand different client-server communication protocols essential for frontend System Design.
The internet is a global network of interconnected computers that enables communication and data exchange using standardized protocols like TCP/IP. The World Wide Web (WWW) is a system of interlinked documents and resources accessed via the internet using protocols like HTTP and HTTPS. The interconnected computers over the WWW are broadly divided into two categories–clients and servers. The clients request resources from the server, and the server entertains the requests based on certain conditions. This communication between the client and server is carried out with the help of an
We’ll start with the HTTP protocol, which is the primary use case in most applications. The other two (RPC and WebSockets) are used extensively in different use cases. We believe these three collectively cover the major concepts of client-server communications.
Web protocols
In frontend System Design, well-defined web protocols ensure seamless
Web protocols operate over TCP/IP, where a user clicks a link on a web page, and the browser uses DNS to resolve the domain name to its corresponding IP address before connecting to the server. It then establishes a TCP connection, initiates a TLS handshake (if using HTTPS), and requests the web page and any related resource. Finally, the browser renders the page, closing the TCP connections. This information flow between clients and servers is facilitated by a hypertext transfer protocol (HTTP) protocol, as shown below:
Application-layer protocols such as the file transfer protocol (FTP), simple mail transport protocol (SMTP), HTTP, and so on use lower-layer protocols like transmission control protocol (TCP), user datagram protocol (UDP), and internet protocol (IP) to provide services to end users.
Let’s explore how HTTP protocol works and enables client and server communication.
Hypertext transfer protocol (HTTP)
The hypertext transfer protocol (HTTP) is a