How to write a "ping" function?

When my live coding setup launches, it needs to get a message from the OSC controller (to know where to send updates).

Currently, I've put a button in the OSC session to send /ping, and I prompt for it during the live-coding startup sequence.

I'd like Open Stage to send /ping periodically, without intervention from me. This would require scheduling (pause between sends, maybe every 5-10 seconds? or until I send a handshake message back).

This didn't leap out of the Open Stage references at me... any tips?

hjh

hi,

maybe search in this forum for the word settimeout
cheers

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

Great, thanks! Will look into that over my winter holiday.

hjh