Skip to content

Commit 234a027

Browse files
author
Mark Gibbs
committed
Some documentation improvements
1 parent 817058e commit 234a027

File tree

3 files changed

+38
-3
lines changed

3 files changed

+38
-3
lines changed

docs/dash_components.rst

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,39 @@
33
Dash components
44
===============
55

6-
The ``dpd-components`` package contains ``Dash`` components.
6+
The ``dpd-components`` package contains ``Dash`` components. This package is installed as a
7+
dependency of ``django-plotly-dash``.
78

89
.. _pipe_component:
910
The ``Pipe`` component
1011
--------------
1112

12-
Blah
13+
Each ``Pipe`` component instance listens for messages on a single channel. The ``value`` member of any message on that channel whose ``label`` matches
14+
that of the component will be used to update the ``value`` property of the component. This property can then be used in callbacks like
15+
any other ``Dash`` component property.
16+
17+
An example, from the demo application:
18+
19+
.. code-block:: python
20+
21+
import dpd_components as dpd
22+
23+
app.layout = html.Div([
24+
...
25+
dpd.Pipe(id="named_count_pipe", # ID in callback
26+
value=None, # Initial value prior to any message
27+
label="named_counts", # Label used to identify relevant messages
28+
channel_name="live_button_counter"), # Channel whose messages are to be examined
29+
...
30+
])
31+
32+
The ``value`` of the message is sent from the server to all front ends with ``Pipe`` components listening
33+
on the given ``channel_name``. This means that this part of the message should be small, and it must
34+
be JSON serialisable. Also, there is no guarantee that any callbacks will be executed in the same Python
35+
process as the one that initiated the initial message from server to front end.
36+
37+
The ``Pipe`` properties can be persisted like any other ``DashApp`` instance, although it is unlikely
38+
that continued persistence of state on each update of this component is likely to be useful.
39+
40+
This component requires a bidirectional connection, such as a websocket, to the server. Inserting
41+
a ``plotly_message_pipe`` :ref:`template tag <plotly_message_pipe>` is sufficient.

docs/template_tags.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ At least one of ``da``, ``slug`` or ``name`` must be provided. An object identif
3636
identified by ``name`` will be. If either of these arguments are provided, they must resolve to valid objects even if
3737
not used. If neither are provided, then the model instance in ``da`` will be used.
3838

39+
.. _plotly_message_pipe:
40+
3941
The ``plotly_message_pipe`` template tag
4042
----------------------------------------
4143

docs/updating.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@ Live updating blah.
88
Message channels
99
----------------
1010

11-
Blah
11+
Messages are passed through named channels, and each message consists
12+
of a ``label`` and ``value`` pair.
1213

1314
Pipes
1415
-----
1516

1617
A :ref:`Pipe <pipe_component>` component is provided.
1718

19+
HTTP Endpoint
20+
-------------
1821

22+
There is an HTTP endpoint that allows direct insertion of messages into a message channel.
1923

0 commit comments

Comments
 (0)