Add webSocketKeepAliveTime setting to aid testing.

This commit is contained in:
Mark Hindess 2014-07-30 13:57:25 +01:00
parent 47f7cb52d8
commit 8e30910065
1 changed files with 4 additions and 2 deletions

View File

@ -35,6 +35,8 @@ function init(_server,_settings) {
}
function start() {
var webSocketKeepAliveTime = settings.webSocketKeepAliveTime || 15000;
var path = settings.httpAdminRoot || "/";
path = path + (path.slice(-1) == "/" ? "":"/") + "comms";
wsServer = new ws.Server({server:server,path:path});
@ -74,11 +76,11 @@ function start() {
heartbeatTimer = setInterval(function() {
var now = Date.now();
if (now-lastSentTime > 15000) {
if (now-lastSentTime > webSocketKeepAliveTime) {
lastSentTime = now;
publish("hb",lastSentTime);
}
}, 15000);
}, webSocketKeepAliveTime);
}
function publish(topic,data,retain) {