Skip to content

Commit

Permalink
Add a keep-alive NOOP to the C-Gate connection
Browse files Browse the repository at this point in the history
  • Loading branch information
rbswift authored Jul 10, 2022
1 parent ded597b commit cae3fed
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ var queue2 = {
var HOST = settings.cbusip;
var COMPORT = 20023;
var EVENTPORT = 20025;
var KEEPALIVE = 30;

var logging = settings.logging;

Expand All @@ -109,6 +110,11 @@ function started(){
queue2.write('GET //'+settings.cbusname+'/'+settings.getallnetapp+'/* level\n');
},settings.getallperiod*1000);
}
// Send a NOOP to the Cgate server to keep the connection open and detect if the connection was closed
setInterval(function(){
console.log('NOOP');
command.write('NOOP\n');
},KEEPALIVE);
}

}
Expand Down

0 comments on commit cae3fed

Please sign in to comment.