Can a web browser use MQTT?

后端 未结 8 1561
名媛妹妹
名媛妹妹 2020-12-13 00:18

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 impleme

8条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-13 00:48

    This link (Download codes) is useful. Download it and modify this file mosq-mqttws31.html. Instead of the embedded java script library use this cdn

    https://cdnjs.cloudflare.com/ajax/libs/paho-mqtt/1.0.1/mqttws31.js

    and the client instantiation should be client = new Paho.MQTT.Client("test.mosquitto.org", 8080,"myclien256tiffffd_" + parseInt(Math.random() * 100, 10));

提交回复
热议问题