WebSockets Protocol

Jump to navigation Jump to search

A WebSockets Protocol is a digital communication protocol that provides full-duplex communication channels over a single TCP connection.



  • chat
    • HTTP, gRPC, and WebSockets are all network protocols used for communication between computer systems, but they have different characteristics and use cases. Here is a brief overview of each protocol:
      • HTTP (Hypertext Transfer Protocol): HTTP is a request-response protocol used for transmitting data over the internet. It is the foundation of the World Wide Web and is used for transmitting data between web servers and web browsers. HTTP is a stateless protocol, which means that each request/response cycle is independent of the others, and it uses TCP (Transmission Control Protocol) as its transport layer protocol.
      • gRPC: gRPC is a modern open-source framework developed by Google for building high-performance, language-agnostic microservices. It is based on the Remote Procedure Call (RPC) paradigm, which allows applications to call functions or procedures on remote servers as if they were local functions. gRPC uses the Protocol Buffers data format and supports multiple transport protocols, including HTTP/2, allowing for fast and efficient communication between systems.
      • WebSockets: WebSockets is a protocol that provides full-duplex communication channels over a single TCP connection. It is used for real-time communication between web browsers and web servers, allowing for interactive applications such as online games or chat systems. WebSockets allow for bi-directional communication, which means that data can be sent and received in both directions simultaneously, making it a more efficient way to handle real-time data.
    • Overall, each of these protocols has its own strengths and weaknesses and is suited for different types of applications. HTTP is used for traditional client-server web applications, while gRPC is used for high-performance microservices, and WebSockets is used for real-time communication. Understanding the differences between these protocols can help developers choose the best option for their specific use case.


  • (Wikipedia, 2020) ⇒ https://en.wikipedia.org/wiki/WebSocket Retrieved:2020-3-6.
    • WebSocket is a computer communications protocol, providing full-duplex communication channels over a single TCP connection. The WebSocket protocol was standardized by the IETF as RFC 6455 in 2011, and the WebSocket API in Web IDL is being standardized by the W3C.

      WebSocket is distinct from HTTP. Both protocols are located at layer 7 in the OSI model and depend on TCP at layer 4. Although they are different, RFC 6455 states that WebSocket "is designed to work over HTTP ports 80 and 443 as well as to support HTTP proxies and intermediaries," thus making it compatible with the HTTP protocol. To achieve compatibility, the WebSocket handshake uses the HTTP Upgrade header to change from the HTTP protocol to the WebSocket protocol.

      The WebSocket protocol enables interaction between a web browser (or other client application) and a web server with lower overhead than half-duplex alternatives such as HTTP polling, facilitating real-time data transfer from and to the server. This is made possible by providing a standardized way for the server to send content to the client without being first requested by the client, and allowing messages to be passed back and forth while keeping the connection open. In this way, a two-way ongoing conversation can take place between the client and the server. The communications are done over TCP port number 80 (or 443 in the case of TLS-encrypted connections), which is of benefit for those environments which block non-web Internet connections using a firewall. Similar two-way browser-server communications have been achieved in non-standardized ways using stopgap technologies such as Comet.

      Most browsers support the protocol, including Google Chrome, Microsoft Edge, Internet Explorer, Firefox, Safari and Opera.