A bi-directional communication technology that provides full-duplex communication channels over the web, enabling real-time data exchange between servers and clients. Unlike traditional HTTP requests, Web Sockets establish persistent connections, allowing for efficient bidirectional data transfer.

Notes

Web Sockets offer a way to send and receive data simultaneously. After establishing a 🔌 WebSocket connection through a single handshake, both parties can exchange data at any time without the need for new HTTP connections.

TakeAways

  • 📌 Enables real-time communication between web servers and clients.
  • 💡 Uses persistent connections for efficiency.
  • 🔍 Unlike traditional HTTP requests, Web Sockets are bidirectional.

Process

  1. Client Initiation: The client initiates a WebSocket connection to the server.
  2. Handshake: Both parties exchange headers similar to an HTTP request/response cycle to establish the connection.
  3. Data Exchange: Once connected, data can be sent and received in real-time using text or binary frames.

Thoughts

  • 🚀 Fast: Reduces latency by reusing TCP connections for both sending and receiving data.
  • 💼 Reliable: Provides reliable, ordered, line-oriented messages between clients and servers.
  1. REST
  2. Wikipedia: Web Socket
  3. Mozilla Developer Network - Web Sockets