Skip to content

Commit

Permalink
Add configurable websocket heartbeat (#826)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
scratchings authored Mar 5, 2024
1 parent 41fec50 commit d562cae
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/ood_core/batch_connect/templates/vnc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ def run_script
# successful connections so that the password can be reset
def after_script
websockify_cmd = context.fetch(:websockify_cmd, "${WEBSOCKIFY_CMD:-/opt/websockify/run}").to_s

websockify_hb = context.fetch(:websockify_hb, "${WEBSOCKIFY_HB:-30}").to_s

<<-EOT.gsub(/^ {14}/, "")
#{super}
Expand All @@ -139,7 +140,7 @@ def after_script
start_websockify() {
local log_file="./websockify.log"
# launch websockify in background and redirect all output to a file.
#{websockify_cmd} $1 $2 &> $log_file &
#{websockify_cmd} $1 --heartbeat=#{websockify_hb} $2 &> $log_file &
local ws_pid=$!
local counter=0
Expand Down

0 comments on commit d562cae

Please sign in to comment.