New issue
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
WebSockets are not closed on non zero CONNACK return codes #1718
Comments
This works as expected for me. What version of Mosquitto and libwebsockets do you have? |
I am currently using |
I was expecting you to say 1.4.10 or something equally old, 1.6.9 should be working fine. |
Ok - just checked this again and it seems to be an issue where the client implementation I am using is not correctly listening for socket close. Sorry for the wrong error report. |
So I did even more testing and I have a reproducible example where mosquitto is not disconnecting: conf file
passwd file
test codePaste this in Chrome Developer Tools and see that "close" never gets printed: (() => {
const data = new Uint8Array([
0x10, 0x47, 0x00, 0x06, 0x4d, 0x51, 0x49, 0x73, 0x64, 0x70, 0x03, 0xc2,
0x00, 0x3c, 0x00, 0x24, 0x65, 0x34, 0x38, 0x36, 0x64, 0x37, 0x39, 0x61,
0x2d, 0x39, 0x66, 0x38, 0x31, 0x2d, 0x34, 0x31, 0x64, 0x31, 0x2d, 0x62,
0x61, 0x66, 0x65, 0x2d, 0x30, 0x37, 0x35, 0x36, 0x36, 0x35, 0x30, 0x62,
0x36, 0x39, 0x33, 0x35, 0x00, 0x03, 0x62, 0x6f, 0x62, 0x00, 0x0e, 0x77,
0x72, 0x6f, 0x6e, 0x67, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64
]);
const ws = new WebSocket("ws:https://127.0.0.1:9012/mqtt", "mqtt");
ws.onopen = () => {
console.log("open");
ws.send(data);
};
ws.onclose = () => console.log("close");
})(); |
Thank you for the easy check, I've got round to looking at this and have just pushed a change that fixes it. |
If I send a CONNECT packet with invalid credentials, mosquitto will return a CONNACK packet with this content:
0x20 0x02 0x00 0x05
. This is correct, except per the spec the broker has to close the connection after sending a non 0 return code, which mosquitto does not do.The text was updated successfully, but these errors were encountered: