I am new to this IoT protocol area. My understanding is that MQTT is a lightweight messaging protocol for IOT devices.
MQTT over web socket involves use of HTTP to UPGRADE the connection to use web socket. Otherwise they follow same protocol for data exchange.
Both sit on top of the TCP layer.
Both support a persistent connection.
Both support pub/sub model.
The use case difference between the 2 is said to be that MQTT over web socket is ideal when client is a browser since it is difficult to implement MQTT in browser (but this can be made possible by using Socket API).
So what exactly is the technical difference between MQTT and MQTT over web socket that allows the later to be preferred by web browser apps?
Why not use MQTT directly? Currently, it is not possible to speak pure MQTT in a browser because it is not possible to open a raw TCP connection. Socket API will change that situation; however, few browsers implement this API yet.