kevoree-group-centralizedws
Version:
WebSocket group based on a centralized architecture that only sends partial model to connected clients
56 lines (48 loc) • 1.03 kB
JavaScript
const kGroupMock = require('./kGroupMock');
function InstanceMock(nodeName, name) {
this.nodeName = nodeName;
this.name = name;
this.currentModel = null;
this.kInstance = kGroupMock;
this.dictionary = {
getString(name) {
switch (name) {
case 'masterNet':
return 'lo.ipv4';
case 'onDisconnect':
return '// nothing';
default:
return undefined;
}
}
};
this.dic_onDisconnect = {};
this.dic_onDisconnect.defaultValue = 'lo.ipv4';
}
InstanceMock.prototype = {
getName() {
return this.name;
},
getNodeName() {
return this.nodeName;
},
getKevoreeCore() {
const self = this;
return {
getCurrentModel() {
return self.currentModel;
},
deploy: () => Promise.resolve(),
on: () => {},
off: () => {},
submitScript: () => {}
};
},
getModelEntity() {
return this.kInstance;
},
getDictionary() {
return this.dictionary;
}
};
module.exports = InstanceMock;