You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/contributing/guides/events.md
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,6 +54,14 @@ Some examples of events that are emitted from the Dashboard to Node-RED include:
54
54
-`widget-action` - When a user interacts with a widget, and state of the widget is not important, e.g. a button click
55
55
-`widget-send` - Used by `ui-template` to send a custom `msg` object, e.g. `send(msg)`, which will be stored in the server-side data store.
56
56
57
+
#### Syncing Widgets
58
+
59
+
The `widget-change` event is used to emit input from the server, and represents a change of state for that widget, e.g. a switch can be on/off by a user clicking it. In this case, if you have multiple clients connected to the same Node-RED instance, Dashboard will ensure that clients are in-sync when values change.
60
+
61
+
For Example if you move a slider on one instance of the Dashboard, all sliders connected will also auto-update.
62
+
63
+
To disable this "single source of truth" design pattern, you can check the widget type in the ["Client Data"](../../user/multi-tenancy#configuring-client-data) tab of the Dashboard settings.
64
+
57
65
## Events List
58
66
59
67
This is a comprehensive list of all events that are sent between Node-RED and the Dashboard via socket.io.
@@ -100,6 +108,11 @@ and the `widget-change` received a new value of `40`, then the newly emitted mes
100
108
101
109
Any value received here will also be stored against the widget in the datastore.
102
110
111
+
### `widget-sync`
112
+
- Payload: `<msg>`
113
+
114
+
Triggered from the server-side `onChange` handler. This send a message out to all connected clients and informs relevant widgets of state/value changes. For example, when a slider is moved, the `widget-sync` message will ensure all connected clients, and their respective slider, are updated with the new value.
0 commit comments