Skip to content
Discussion options

You must be logged in to vote

first you need to send the token through with your POST request -- get can get this from sessionStorage.get("token") or by calling getToken from $/utils/state.js.

then you need to use that token to get the associated state and modify it

async with app.modify_state(f"{token}_{IndexState.get_full_name}") as root_state:
    index_state = await root_state.get_state(IndexState)
    index_state.last_temperature = value_from_request

when the context exits, the value will be persisted and sent to the client (if they are still connected).

prior to 0.8.17, if the client had reconnected to a different app instance, then the update would not have been sent.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@erick-dumas
Comment options

Answer selected by erick-dumas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants