Sending data from node-red to local webpage

I'd like some help to my project, I do not know how to proceed.

Actually, I have a python code which send data to mosquitto and in my node I have a mqtt listener which get my data from my python code. Then I send those data to influxdb and then I use grafana to display my data in a time series graph. This works perfectly. My problem is that grafana allow you to display data with timeseries. Or I'd like to make X/Y plot.
So my idea is, from node-red and my MQTT listener, I send the data to a personal web page (this webpage could run locally in a local server, let's say localhost:1234 for example). On this server I run my index.html with some javascript on it and the plotly.js library which allows to make nice plot.

I have completly no idea how to send the data from node-red to a external webpage running on a local server... Someone could orientate me ? If you guys know some links or tutorial for this, it would be great.
Thank you

Create an http-endpoint and serve the data there.

From the webpage (running with a server), make a request to the http endpoint.

Ok great, thank you for you help

Do you realise that you could do all of this from within Node-RED?

Node-RED has two web servers already defined. 1 for the admin tasks including the editor. The other serves up user-facing stuff including static assets, Dashboard and uibuilder.

If you already have some front-end code, then you can serve that using the static folder. But if you want to go further and have a dedicated websockets channel for communications between Node-RED and your front-end then uibuilder can do that and will likely work with your existing code with minimal modifications.

1 Like

Great! I did not know those tools, it's exactly what I need. Thank you for sharing!