Child Node Framework Update : syntax fixes
parent
d7409db6f0
commit
f336bb654a
|
@ -4,7 +4,6 @@ const https = require('https');
|
|||
const express = require('express');
|
||||
const { createWebSocketServer, createWebSocketClient } = require('./basic/websocketTools.js')
|
||||
module.exports = function(s,config,lang,app,io){
|
||||
const { cameraDestroy } = require('./monitor/utils.js')(s,config,lang)
|
||||
//setup Master for childNodes
|
||||
if(config.childNodes.enabled === true && config.childNodes.mode === 'master'){
|
||||
const {
|
||||
|
@ -36,12 +35,12 @@ module.exports = function(s,config,lang,app,io){
|
|||
});
|
||||
s.debugLog('childNodeWebsocket.attach(childNodeServer)')
|
||||
//send data to child node function
|
||||
s.cx = function(data,connectionId,senderObject){
|
||||
s.cx = function(data,connectionId){
|
||||
// if(senderObject){
|
||||
// data.sentFrom = senderObject.id;
|
||||
// childNodesConnectionIndex[y].sendJson(data)
|
||||
// childNodesConnectionIndex[connectionId].sendJson(data)
|
||||
// }else{
|
||||
childNodesConnectionIndex[y].sendJson(data)
|
||||
childNodesConnectionIndex[connectionId].sendJson(data)
|
||||
// }
|
||||
}
|
||||
//child Node Websocket
|
||||
|
@ -82,8 +81,7 @@ module.exports = function(s,config,lang,app,io){
|
|||
onMessage: onDataFromMasterNode
|
||||
})
|
||||
function sendDataToMasterNode(data){
|
||||
x.socketKey = config.childNodes.key;
|
||||
childIO.send(JSON.stringify(data));
|
||||
childIO.send(JSON.stringify(data))
|
||||
}
|
||||
s.cx = sendDataToMasterNode;
|
||||
s.tx = function(x,y){
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
module.exports = function(s,config,lang,app,io){
|
||||
const { cameraDestroy } = require('../monitor/utils.js')(s,config,lang)
|
||||
const queuedSqlCallbacks = s.queuedSqlCallbacks;
|
||||
var checkCpuInterval = null;
|
||||
function onDataFromMasterNode(d) {
|
||||
|
@ -17,7 +18,6 @@ module.exports = function(s,config,lang,app,io){
|
|||
case'kill':
|
||||
s.initiateMonitorObject(d.d);
|
||||
cameraDestroy(d.d)
|
||||
var childNodeIp = s.group[d.d.ke].activeMonitors[d.d.id]
|
||||
break;
|
||||
case'sync':
|
||||
s.initiateMonitorObject(d.sync);
|
||||
|
@ -46,10 +46,11 @@ module.exports = function(s,config,lang,app,io){
|
|||
function initiateConnectionToMasterNode(){
|
||||
console.log('CHILD CONNECTION SUCCESS')
|
||||
s.cx({
|
||||
f : 'init',
|
||||
port : config.port,
|
||||
coreCount : s.coreCount,
|
||||
availableHWAccels : config.availableHWAccels
|
||||
f: 'init',
|
||||
port: config.port,
|
||||
coreCount: s.coreCount,
|
||||
availableHWAccels: config.availableHWAccels,
|
||||
socketKey: config.childNodes.key
|
||||
})
|
||||
clearInterval(checkCpuInterval)
|
||||
checkCpuInterval = setInterval(async () => {
|
||||
|
|
|
@ -10,8 +10,7 @@ module.exports = function(s,config,lang,app,io){
|
|||
client.ip = ipAddress;
|
||||
client.shinobiChildAlreadyRegistered = true;
|
||||
client.sendJson = (data) => {
|
||||
const dataString = JSON.stringify(data);
|
||||
client.send(dataString)
|
||||
client.send(JSON.stringify(data))
|
||||
}
|
||||
if(!s.childNodes[ipAddress]){
|
||||
s.childNodes[ipAddress] = {}
|
||||
|
@ -30,9 +29,7 @@ module.exports = function(s,config,lang,app,io){
|
|||
childNodes : s.childNodes
|
||||
})
|
||||
activeNode.coreCount = options.coreCount
|
||||
return {
|
||||
ipAddress,
|
||||
}
|
||||
return ipAddress
|
||||
}
|
||||
function initiateVideoTransferConnection(){
|
||||
|
||||
|
|
Loading…
Reference in New Issue