user1970295
user1970295

Reputation: 121

MQTT Client for node.js playloads larger than 128 bytes

I try to understand and implement the MQTT-Client for node.js, which can be found at: http://jahbromo.blogspot.de/2011/12/client-mqttt-javascript.html

When I publish playloads lower than 128 bytes there's no problem and the message gets directed correctly, but when the payload is larger, node.js prints out "Connection closed by broker" right after the publishing. Because i'm relatively new to websockets and node.js I don't understand why this node.js-server-implemenatation mentioned above can't handle playloads larger than 128 bytes. Because I need to send larger payloads, it would be great if someone could help me to increase the limitation.

Thanks.

Upvotes: 1

Views: 2334

Answers (1)

ralight
ralight

Reputation: 11608

You'll notice down in the limitations of the code you link to (which is actually a modified version of https://github.com/yilun/node_mqtt_client ):

Can not handle payloads larger than 128 byte.

This is a limitation of the client library, not of MQTT.

To add support for larger payloads, you need to implement full "remaining length" support for the PUBLISH packet as described in the spec: http://public.dhe.ibm.com/software/dw/webservices/ws-mqtt/mqtt-v3r1.html#fixed-header

Upvotes: 2

Related Questions