Skip to content

Commit d562cae

Browse files
authored
Add configurable websocket heartbeat (#826)
Without the --heartbeat option the VNC session will timeout after 1 minute of idle time. This adds --heartbeat with a default of 30 seconds, configurable with websockify_hb in the context or the environment variable WEBSOCKIFY_HB
1 parent 41fec50 commit d562cae

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

  • lib/ood_core/batch_connect/templates

lib/ood_core/batch_connect/templates/vnc.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ def run_script
130130
# successful connections so that the password can be reset
131131
def after_script
132132
websockify_cmd = context.fetch(:websockify_cmd, "${WEBSOCKIFY_CMD:-/opt/websockify/run}").to_s
133-
133+
websockify_hb = context.fetch(:websockify_hb, "${WEBSOCKIFY_HB:-30}").to_s
134+
134135
<<-EOT.gsub(/^ {14}/, "")
135136
#{super}
136137
@@ -139,7 +140,7 @@ def after_script
139140
start_websockify() {
140141
local log_file="./websockify.log"
141142
# launch websockify in background and redirect all output to a file.
142-
#{websockify_cmd} $1 $2 &> $log_file &
143+
#{websockify_cmd} $1 --heartbeat=#{websockify_hb} $2 &> $log_file &
143144
local ws_pid=$!
144145
local counter=0
145146

0 commit comments

Comments
 (0)