mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-11-10 14:09:43 -05:00
Added MQTT support over WSS and multiplexed with MPS
This commit is contained in:
10
webserver.js
10
webserver.js
@@ -3323,6 +3323,16 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
||||
try { obj.meshAgentHandler.CreateMeshAgent(obj, obj.db, ws, req, obj.args, domain); } catch (e) { console.log(e); }
|
||||
});
|
||||
|
||||
// MQTT broker over websocket
|
||||
obj.app.ws(url+'mqtt.ashx', function (ws, req) {
|
||||
var ser = SerialTunnel();
|
||||
ws.on('message', function(b) { ser.updateBuffer(Buffer.from(b,'binary'))});
|
||||
ser.forwardwrite = function(b) { ws.send(b,"binary")}
|
||||
ws.on("close", function() { ser.emit('end');});
|
||||
//pass socket wrapper to mqtt broker
|
||||
obj.parent.mqttbroker.handle(ser);
|
||||
})
|
||||
|
||||
// Memory Tracking
|
||||
if (typeof obj.args.memorytracking == 'number') {
|
||||
obj.app.get(url + 'memorytracking.csv', function (req, res) {
|
||||
|
||||
Reference in New Issue
Block a user