How to write a "ping" function?

If you're already using a custom module, this (old) reply applies : How to send a message periodically & other questions - #2 by jean-emmanuel

Otherwise a periodic action can be scheduled using javascript's setInterval function from any widget's onCreate script: (see Scripting - Open Stage Control)

setInterval(()=>{
  send('127.0.0.1:5555', '/ping')
}, 5000 /* ms */)
1 Like