diff --git a/red/comms.js b/red/comms.js index be23729a6..3664f55cc 100644 --- a/red/comms.js +++ b/red/comms.js @@ -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) {