in greengrass-opcua-adapter-nodejs/subscriber.js [83:107]
constructor(client, serverConfig, monitoredItemsConfig, customConfig) {
this._client = client;
this._serverConfig = serverConfig;
this._monitoredItemsConfig = monitoredItemsConfig;
this._customConfig = customConfig;
const self = this;
this.on('connect', () => {
self.createSession();
});
this.on('session_create', () => {
self.createSubscription();
});
this.on('subscribe', () => {
self.monitorNodes();
});
// This is reconnection mechanism inside the OPCUAClient, and
// There's already a default handle function in OPCUAClient
// class as a prototype, what I modify here is to override it to
// fit our architecture.
client._on_connection_reestablished = function (callback) {
console.log(" client._on_connection_reestablished".bgWhite.red);
self.emit('connect');
}
}