WebSocket API
WebSocket is a new HTML5 protocol that enables full-duplex communication between client and server, allowing data to flow quickly in both directions. A simple handshake establishes the connection; after that, the server can proactively push messages to the client based on business rules. Benefits:
- Very small header overhead during data transfer (about 2 bytes).
- Both client and server can actively send data to each other.
- No repeated TCP connection setup/teardown—saves bandwidth and server resources.