WebSocket starts as an ordinary HTTP request with an upgrade header and then keeps the TCP connection open for framed messages in either direction. It exists because HTTP alone cannot push: a web dashboard that shows live sensor values would otherwise have to poll. Because it uses standard ports and passes through most proxies and firewalls, it is the usual way to get live data into a browser.
In IoT it appears in two places. Browser-based tools subscribe to telemetry through a WebSocket feed, and MQTT is frequently tunneled over WebSocket so that web clients, or devices behind restrictive corporate networks, can reach a broker on port 443. WebSocket defines only framing, not message semantics, so applications still need a protocol on top. It is not designed for tiny microcontrollers, where the HTTP handshake and TLS cost are significant.
Part of the IoT Glossary. Spotted an error or a missing term? Tell us.