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

First pass at adding WebRTC support.

This commit is contained in:
Ylian Saint-Hilaire 2018-01-16 17:30:34 -08:00
parent 65d6775303
commit 92aaf754fb
12 changed files with 164 additions and 141 deletions

View file

@ -175,16 +175,16 @@ module.exports.CreateMeshRelay = function (parent, ws, req, domain) {
}
}
}
ws.flushSink = function () {
try { ws.resume(); } catch (e) { }
};
ws.flushSink = function () { try { ws.resume(); } catch (e) { } };
// When data is received from the mesh relay web socket
ws.on('message', function (data) {
//console.log(typeof data, data.length);
//if (typeof data == 'string') console.log(data);
if (this.peer != null) { try { this.pause(); this.peer.send(data, ws.flushSink); } catch (e) { } }
if (this.peer != null) {
//if (typeof data == 'string') { console.log('Relay: ' + data); }
try { this.pause(); this.peer.send(data, ws.flushSink); } catch (e) { }
}
});
// If error, do nothing