MQTT over WebSocket
also: MQTT-WS, MQTT/WebSocket
A protocol that carries MQTT (Message Queuing Telemetry Transport) over WebSocket connections, allowing lightweight publish-subscribe messaging through standard HTTP upgrade mechanisms in web browsers and web applications.
MQTT over WebSocket wraps the binary MQTT protocol inside WebSocket frames, enabling real-time bidirectional communication between web clients and MQTT brokers. Normally MQTT uses TCP directly; WebSocket adds an HTTP compatibility layer that allows JavaScript clients running in browsers to connect without requiring separate TCP socket support.
This is particularly useful for web-based IoT dashboards and monitoring applications. For example, a browser-based dashboard can subscribe to sensor data topics and receive live updates without polling, while the underlying communication still benefits from MQTT's efficiency and QoS guarantees.
The connection typically uses the WebSocket URI scheme ws:// or wss:// (secure) on standard HTTP ports (80/443), making it easier to traverse firewalls and proxies that might block raw TCP traffic. Brokers like Mosquitto and HiveMQ offer built-in MQTT over WebSocket listeners.