To put it simply, the Web page you are viewing (the URL begins with http://) is transmitted to your browser by the HTTPS protocol, and HTTP is based on the socket, which is a set of interfaces to complete the TCP, UDP protocol.
HTTP protocol: Simple Object Access Protocol, corresponding to the application layer, the HTTP protocol is based on the TCP connection.
TCP protocol: Corresponds to the transport layer
IP protocol: Corresponds to the network layer
TCP/IP is a Transport layer protocol that mainly addresses how data is transmitted over the network: HTTP is an application-layer protocol that mainly addresses how data is packaged.
Socket is the TCP/IP protocol encapsulation, the socket itself is not a protocol, but a call interface (API), through the socket, we can use the TCP/IP protocol.
HTTP connection: The HTTP connection is called a short connection, that is, the client sends a request to the server, and the server-side response is disconnected.
Socket connection: Socket is the so-called long connection, in theory, the client and the server side once established connection will not be active, but due to various environmental factors may cause disconnection, such as: Server side or client host down, network failure, Or there is no data transfer between the two for a long time, the network firewall may disconnect the connection to free up network resources, so when there is no data transfer in a socket connection, heartbeat messages are sent to maintain the connection, and the heartbeat message is the developer's own definition.
The difference between a socket connection and an HTTP connection