Closed swapnil-hike closed 7 years ago
Script (copied from example ) and wireshark attached frag.pcap.zip
var net = require('net') var mqttCon = require('mqtt-connection') var server = new net.Server()
server.on('connection', function (stream) { var client = mqttCon(stream)
// client connected client.on('connect', function (packet) { // acknowledge the connect packet client.connack({ returnCode: 0 }); })
// client published client.on('publish', function (packet) { // send a puback with messageId (for QoS > 0) client.puback({ messageId: packet.messageId }) })
// client pinged client.on('pingreq', function () { // send a pingresp client.pingresp() });
// client subscribed client.on('subscribe', function (packet) { // send a suback with messageId and granted QoS level client.suback({ granted: [packet.qos], messageId: packet.messageId }) })
// timeout idle streams after 5 minutes stream.setTimeout(1000 60 5)
// connection error handling client.on('close', function () { client.destroy() }) client.on('error', function () { client.destroy() }) client.on('disconnect', function () { client.destroy() })
// stream timeout stream.on('timeout', function () { client.destroy(); }) })
// listen on port 1883 server.listen(1883)
which OS are you using? can you verify if you get the same behavior just using https://github.com/mqttjs/mqtt-packet?
@mcollina Thanks a lot .. Have shelved the project for a while .. Will test it when ever possible and let you know.
Single mqtt message are received as multiple TCP PDU's on client.