Proof-of-concept MQTT to Websockets bridge.
The bridge forwards messages from websocket clients to the MQTT broker and vice versa.
-
Install the dependencies and start the mosquitto server.
mosquitto
-
Build and start the bridge.
cd mqtt-websockets-bridge/src make ./bridge
-
Open public/index.html in multiple browser instances.
-
Publish a message using the mosquitto client.
mosquitto_pub -t /foo/bar -m "Hello World"
- libwebsockets 1.23
- mosquitto 1.2.3
- A websockets capable browser
- A posix compliant system (Only tested on OS X 10.9.1)
see MQTT Clients
The event loop integration of mosquitto and websockets is very simple. Both loops simply run alternating for 20 milliseconds.
Currently only simple subscription is possble by sending the topic path through the websockets connection. This is subject to change.
- Benchmark
- Tests