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

Commit

Permalink
Merge pull request #2 from kilianme/master
Browse files Browse the repository at this point in the history
Replace timeout with initialized event
  • Loading branch information
dserve authored Dec 1, 2017
2 parents d475018 + 0fe5b80 commit c23e563
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 c23e563

Please sign in to comment.