class trame_server.state.State(server)

Flexible dictionary managing a server shared state. Variables can be accessed with either the [] or . notation.


Tag a given set of variable name(s) to be client only. This means that when they get changed on the client side, the server will not be aware of their change and no network bandwidth will be used to maintain the server in sync with the client state.



A list a variable name


Flush current state modification and return the resulting state state as a python dict.


Check is a key is currently available in the state

setdefault(key, value)

Set an initial value if the key is not present yet


Check if any provided key name(s) still has a pending changed that will need to be flushed.


Check if all provided key name(s) has a pending changed that will need to be flushed.


Mark existing variable name(s) to be modified in a way that they will be pushed again at flush time.


Save pending variable(s) and unmark them as dirty. This will prevent change listener(s) to react or the client to be aware of any change.


Update the current state dict with the provided one


Force pushing modified state and execute any @state.change listener

property change

Function decorator for registering state change executions

property initial

Return the initial state without triggering a flush