MQTT.js not connecting from websockets
问题 I'm trying to connect to websocket client of MQTT.js but unable to get a handshake with the server. My Code : <html> <head> <title>test Ws mqtt.js</title> </head> <body> <script src="//unpkg.com/mqtt@2.5.0/dist/mqtt.min.js"></script> <script> var options = { clientId: 'service-3Kx03pKnM2', connectTimeout: 5000, hostname: 'xxx.xxx.xxx', port: 8000 }; var client = mqtt.connect(options); client.on('connect', function () { client.subscribe('presence'); client.publish('presence', 'Hello mqtt') });