FlowFuse / FlowFuse/node-red-dashboard
Overriding the default onInput handler
- Dominant language
- HTML
- Stars
- 355
- Forks
- 82
- Avg merge
- 4d 23h
- Merged PRs (30d)
- 24
Description
Hi guys,
I have a noob question about overriding the default oninput handler (see [documentation](https://github.com/FlowFuse/node-red-dashboard/blob/main/docs/contributing/guides/registration.md?plain=1#L151)).
I 'think' I do it similar as in the ui-chart node:
```
// server-side event handlers
const evts = {
onInput: function (msg, send, done) {
// My custom onInput handler
...
},
onSocket: {
...
},
beforeSend: function (msg) {
...
}
}
// inform the dashboard UI that we are adding this node
if (group) {
group.register(node, config, evts)
```
But when I inject a message into my node, this happens:
1. The message arrives in my Vue frontend code
2. The `beforeSend` of my node is called
3. My custom onInput handler above is being called
I had assumed that only 3 would happen, and not 1 and 2. Because 1 and 2 are triggered by the default onInput handler (which I have overridden)? Or perhaps I have not interpreted the documentation correctly?
Based on the msg.topic:
+ Some messages only need server side processing, so they don't need to be send to the frontend
+ Some messages need to be send to the frontend.
Can you please give me any tips about how I could achieve something like that.
Thanks!!
Bart
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.