Can a web browser use MQTT?

fred basset picture fred basset · Apr 16, 2013 · Viewed 46.3k times · Source

We are looking at using MQTT as the messaging protocol on a new device we're building. We'd also like a web interface for the device. Does anyone know if you can implement a browser client app (without additional plugins) that talks MQTT?

Answer

hardillb picture hardillb · Apr 17, 2013

Yes, as mentioned in Steve-o's comment MQTT via websockets is very possible.

There are 2 options at the moment

  1. IBM's MQ 7.5 comes with websockets support, you can find details here.
  2. The Mosquitto broker has a javascript client with an example running here.

To answer your second question lighttpd has a websockets module that can be used to do forwarding to an existing broker with details here.

I've not been able to find anything for Apache that doesn't need you to write your own library to do the forwarding.