1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

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

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) {