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

Added support for alternative messenging service.

This commit is contained in:
Ylian Saint-Hilaire 2021-02-04 18:37:38 -08:00
parent 952a13c393
commit b53867ef93
6 changed files with 54 additions and 1 deletions

View file

@ -197,7 +197,10 @@ module.exports.CreateFirebaseRelay = function (parent, url, key) {
obj.connectWebSocket = function () {
if (obj.wsclient != null) return;
obj.wsclient = new WebSocket(relayUrl.href + (key ? ('?key=' + key) : ''), { rejectUnauthorized: false })
obj.wsclient.on('open', function () { obj.wsopen = true; });
obj.wsclient.on('open', function () {
parent.debug('email', 'FBWS-Connected');
obj.wsopen = true;
});
obj.wsclient.on('message', function (msg) {
parent.debug('email', 'FBWS-Data(' + msg.length + '): ' + msg);
var data = null;
@ -214,6 +217,7 @@ module.exports.CreateFirebaseRelay = function (parent, url, key) {
setTimeout(obj.connectWebSocket, 2000);
});
obj.wsclient.on('close', function () {
parent.debug('email', 'FBWS-Disconnected');
obj.wsclient = null;
obj.wsopen = false;
setTimeout(obj.connectWebSocket, 2000);