jean-emmanuel / open-stage-control

Libre and modular OSC / MIDI controller
https://openstagecontrol.ammd.net
GNU General Public License v3.0
720 stars 91 forks source link

[Behavior] /state/set changes are not persistent after a refresh #559

Closed MartinHN closed 5 years ago

MartinHN commented 5 years ago

Hi again! On OSX using node ( not electron) , with last o-s-c release 47.4

If i send /state/set message it works for the connected client, but if i refresh the page, it looses the changes and revert to default. Is it the intended behaviour ? Few notes : As I'm not using electron I don't have a client window continuously running on my server , could it be related? The /state/set message I send is a pruned version of a previously /state/get could this be related?

If it can not change, you know a way to catch the event of a new client connection, so I can send osc from o-s-c to request the modification each time a client connects...

To reproduce the bug

Thanks

jean-emmanuel commented 5 years ago

It is the expected behaviour yes. If you want the state to persist after refreshing you need at least one client that stays connected. (edit: ignore this if you go the custom module way)

jean-emmanuel commented 5 years ago

If it can not change, you know a way to catch the event of a new client connection, so I can send osc from o-s-c to request the modification each time a client connects...

Yes, you can do that from a custom module:

module.exports = {

    init: function(){

        app.on('sessionOpened', (data, client)=>{
            // here you go
        })

    }

}
MartinHN commented 5 years ago

you rocks! Just for info this use case is that I want a lambda user to be able to edit and save modifications without opening the (scary for some people ) edit panel. I use inputs to modify labels and values of buttons then they can save their config . Every thing is send via osc then stored. May be a simpler way of doing things exists. But anyway your answer should work perfectly. Thanks!

jean-emmanuel commented 5 years ago

You're welcome ! At some point I guess #550 might address this.

cyberic99 commented 5 years ago

If you want the state to persist after refreshing you need at least one client that stays connected

doesn't the electron app count as a client?

I would have expected that it counts, but I observe the same as @MartinHN :

I would expect the new client to get the same state as the electron app

If a work around is needed whith a custom module, what do we need to add in the sessionOpened event callback?

thx

jean-emmanuel commented 5 years ago

doesn't the electron app count as a client? I would expect the new client to get the same state as the electron app

It does behave this way. Martin's problem was occuring when not using the electron client.

cyberic99 commented 5 years ago

Martin's problem was occuring when not using the electron client.

I observe the same behehaviour on my (complex) session

I can see the 'new client connected' popup, but the state does not update...

However, I tested with a simple session from scratch, and in this case it works as you say, updating every client...

What could cause my session state not to be transferrred correctly?

Could it be because of a too broad use of 'bypass'?

jean-emmanuel commented 5 years ago

bypass does prevent synchronization, yes.

cyberic99 commented 5 years ago

bypass does prevent synchronization, yes.

In fact, I have bypass set to true for the `root widget...

This is because I'd like every client to be able to display a different tab...

But I also would like sync to work... is it possible?

(I can move this discussion to the discourse if you prefer)

jean-emmanuel commented 5 years ago

Bypassing the root widget will only affect the tab synchronization, it doesn't affect its children. Yes, I'm not sure Martin wants to receive all these messages.

MartinHN commented 5 years ago

no worries