We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I test in mqtt.js like below, unsubscribe thorw some exception, but it have no problem when i use emqx broker, mochi is v2.4.3 and v2.4.1
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script src="https://unpkg.com/mqtt/dist/mqtt.min.js"></script> </head> <body> <button onclick="subscribe()">订阅</button> <button onclick="publish()">发布</button> <button onclick="unsubscribe()">取消订阅</button> </body> <script> const clientId = 'mqttjs_' + Math.random().toString(16).substr(2, 8) const brokerUrl = 'ws://127.0.0.1:1882' // const brokerUrl = 'ws://broker.emqx.io:8083/mqtt' const options = { keepalive: 60, clientId: clientId, protocolId: 'MQTT', protocolVersion: 4, clean: true, reconnectPeriod: 1000, connectTimeout: 30 * 1000, will: { topic: 'WillMsg', payload: 'Connection Closed abnormally..!', qos: 0, retain: false }, } const client = mqtt.connect(brokerUrl, options) client.on('error', (err) => { console.log('Connection error: ', err) client.end() }) client.on('reconnect', () => { console.log('Reconnecting...') }) client.on('connect', () => { console.log('Client connected:' + clientId) }) client.on('message', (topic, message, packet) => { console.log('Received Message: ' + message.toString() + '\nOn topic: ' + topic) }) function publish() { client.publish('testtopic', 'ws connection demo...!', { qos: 0, retain: false }) } function unsubscribe() { client.unsubscribe('testtopic') } function subscribe() { client.subscribe('testtopic', { qos: 0 }) } </script> </html>
The text was updated successfully, but these errors were encountered:
I just found exactly the same problem and was about to create an issue :)
Testing with https://github.com/mqttjs/MQTT.js and v2.4.4. The thrown error from MQTT.js is:
MQTT.js
Error: Malformed unsuback, payload length must be 2
Sorry, something went wrong.
Fix mochi-mqtt#349, MQTT v3 unsuback does not require Reason Code.
9fdbe19
Fix #349, MQTT v3 unsuback does not require Reason Code. (#353)
10a02ab
Successfully merging a pull request may close this issue.
I test in mqtt.js like below, unsubscribe thorw some exception, but it have no problem when i use emqx broker, mochi is v2.4.3 and v2.4.1
The text was updated successfully, but these errors were encountered: