Keeping the session alive

When no more client is connected to a session, all session data seems to be forgotten.
This is a problem when using --no-gui.
For example:

  • open open-stage-control --no-gui --load mySession.json (mySession.json contains a toggle button)
  • start a client on the web browser (e.g localhost:8080); click the toggle button, which is now On.
  • reload the page on the browser: the button is now Off.
  • however, if the URL is opened twice on 2 tabs of the browser, then the button state is preserved when one tab is reload.

Is there is a way to avoid that?

1 Like

There is the possibility of using a custom module to save/restore the client state, there's an example that covers this case here. It could make sense to have something built-in for this though, I'll keep this on my list.

Thanks, that looks promising! I'll try it tomorrow.
Yeah, something built-in would be nice! Like a new server switch. Otoh if a simple custom module does the job, it's ok too.

Ok, I ended up with a simple:

app.on('sessionOpened', (data, client)=>{
    send('localhost', 18080, '/client_connected')
})

Now my (Pd) app can refresh all states when it receives /client_connected. So this answers my needs, thanks!

The Auto-save client state custom module isn't enough in my case, because the states can be sent from the app to the open-stage-control server before any client is connected, so no state can be restored by the custom module when the first client connects...

I wonder if a lightweight http "fake" client could be created to run alongside the server, that would be able to cache the states. My server is launched with node on a headless rPi, so the default open-stage-control GUI cannot be used.