Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
Replaced timeout with initialized event
Browse files Browse the repository at this point in the history
  • Loading branch information
kilimetest committed Dec 1, 2017
1 parent d475018 commit 0fe5b80
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions models/opcua-client-variable.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ class OpcuaClientVariable extends EventEmitter {
if(this.monitoredItem)
return self.debug('is already being monitored.');
this.monitoredItem = this.client.monitorItem(self.nodeId);
setTimeout(function(){

self.monitoredItem.on("initialized",function(){
self.emit('subscribed');
self.monitoredItem.on("changed",function(dataValue){
let value = dataValue.value.value;
//debug(new Date().toString(), nodeId, value);
self.emit("change", value);
});
},5000);
});
}

unsubscribe(){
Expand Down

0 comments on commit 0fe5b80

Please sign in to comment.