mqtt-elements
mqtt-elements copied to clipboard
processing large messages - Websocket connection to 'ws://localhost:8080/' failed: Invalid frame header
When receiving large messages with mqtt-elements Websocket connection to 'ws://localhost:8080/' failed: Invalid frame header
error occurs.
As per specification large messages have to be encoded differently. I have found javascript implementation of this: http://stackoverflow.com/a/10402443
@cordovapolymer could you post an example to reproduce this and specify what a large message is. This is probably a bug at MQTT.js itself.
Full error is
WebSocket connection to 'ws://example.com:8000/ws' failed: Invalid frame header
WebSocket connection to 'ws://example.com:8000/ws' failed: One or more reserved bits are on: reserved1 = 0, reserved2 = 1, reserved3 = 1
One or more reserved bits are on: reserved1 = 0, reserved2 = 1, reserved3 = 1
it happens in mqtt-elements.js at line 7415 in instance = new WebSocket(uri, protocols);
Approximate message size is ~300KB.
I couldn't test it with your demo because it isn't showing received messages.
I am not able to reproduce this.. I am publishing a large message to the broker and correctly receive it at the client. Could you post the code that you are using to connect, subscribe and publish the message.
I am not able to reproduce this.. I am publishing a large message to the broker and correctly receive it at the client. Could you post the code that you are using to connect, subscribe and publish the message.
It seems that this error comes from mosquitto broker, I tried it with MQTT.js 2.0.1 and got the same error, and when switched to aedes it has disappeared.
There might be an issue on the difference between websocket-stream and a basic tls/net stream.
I'll try to see if I can assemble a PR.
@mcollina wait until the end of the week. I will invest some time in mqtt-elements and update to the current mqtt.js version and will make some code cleanup.
Same issue.