1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

More MQTT improvements

This commit is contained in:
Ylian Saint-Hilaire 2019-10-04 17:24:30 -07:00
parent 893fea2329
commit 685dd11fe0
9 changed files with 99 additions and 32 deletions

View file

@ -238,9 +238,11 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
socket.removeAllListeners("close");
socket.setNoDelay(true);
socket.serialtunnel = SerialTunnel();
socket.on('data', function (b) { socket.serialtunnel.updateBuffer(Buffer.from(b, 'binary')) });
socket.serialtunnel.xtransport = 'mps';
socket.serialtunnel.xip = socket.remoteAddress;
socket.on("data", function (b) { socket.serialtunnel.updateBuffer(Buffer.from(b, "binary")) });
socket.serialtunnel.forwardwrite = function (b) { socket.write(b, "binary") }
socket.on("close", function () { socket.serialtunnel.emit('end'); });
socket.on("close", function () { socket.serialtunnel.emit("end"); });
// Pass socket wrapper to the MQTT broker
parent.mqttbroker.handle(socket.serialtunnel);