My dash app has an interface with several hardware components. For the time being, I use an interval component to update the app’s interface. However, this seems to me, as a ‘cruel’ solution. I would prefer to make a request to the server to update the layout, instead of the other way around. Is this possible?
Client side callbacks might be your friend.
Edit: wrong link
The Interval component is still making server requests, just polling at regular intervals. When exactly do you want the layout to be updated?
In my setup, I have a microcontroller connected to my computer. I wrote a dash web app that represents the data this device is collecting through its sensors. One of the sensors detects movement, every time this happens the computer gets a message. Know I would like to show this information in the web app. I think this is normally done with a PUT request (I do not have to allot of experience, with making a web application, hence that Dash is such a great product).
Is your concern that the Interval component will send a request to the server at regular intervals, getting a new layout, regardless of whether the sensor has updated the server with new data (and therefore unnecessarily sending new back tot he client)?
If so, then the solution you’re after is using websocket connections, which allow true push notifications. Dash doesn’t support this at the moment and I don’t know of any current plans to add this functionality.
This Stack Overflow post has a good overview of achieving push-like updates with both websockets and HTTP requests (the Interval approach).
How much do you really need this functionality or is it mainly that the Interval-based requests solutions feels inelegant? I agree it doesn’t feel that clean, but is it really a problem for your use-case?