dpd-components package contains
Dash components. This package is installed as a
Pipe component instance listens for messages on a single channel. The
value member of any message on that channel whose
that of the component will be used to update the
value property of the component. This property can then be used in callbacks like
Dash component property.
An example, from the demo application:
import dpd_components as dpd app.layout = html.Div([ ... dpd.Pipe(id="named_count_pipe", # ID in callback value=None, # Initial value prior to any message label="named_counts", # Label used to identify relevant messages channel_name="live_button_counter"), # Channel whose messages are to be examined ... ])
value of the message is sent from the server to all front ends with
Pipe components listening
on the given
channel_name. This means that this part of the message should be small, and it must
be JSON serialisable. Also, there is no guarantee that any callbacks will be executed in the same Python
process as the one that initiated the initial message from server to front end.
Pipe properties can be persisted like any other
DashApp instance, although it is unlikely
that continued persistence of state on each update of this component is likely to be useful.
This component requires a bidirectional connection, such as a websocket, to the server. Inserting
plotly_message_pipe template tag is sufficient.