Node red http node

Hiii, I have a doubt.
Why my http node show "No response object error in debug". But when i reload my web page this error is removed.

Hi @Kartiknodered - you have not really provided enough info.

But, I suspect you mean "when you refresh node-red editor the error is gone"?

that is normal - the editor only shows status for things that have happened AFTER you loaded the editor.

If you want more help, share your flow and screen shots - maybe we can help.

Ok , i will send you screen shots

One sec... Not refresh node red editor.
I created a web page in in template node and data is coming from server.
That template node is connected to a debug which show error from http response node
And the error is no response object.

A picture would make it much easier to understand.

An error of 'no response object' means you have passed a message to an HTTP Response node that does not contain a msg.res property that came from an HTTP In node.

don't consider that txt file.

You can only pass messages to the HTTP Response node that start from an HTTP In node.

In your flow I can see lots of paths that start an Inject nodes or the Link node that will reach the HTTP Response node and cause the error.

You cannot 'push' updates to a webpage like this. Once an HTTP request to load /tusartest has completed, the browser shows the page and the socket is closed.

If you want to push updates you need to use something like WebSockets that allow messages to be pushed to the browser.

That means including some javascript in your template that will get run in the browser to create a websocket back to a WebSocket node in Node-RED. You will then be able to pass messages to that WebSocket node, the payload will get received in your webpage, and then the JavaScript on the page can do whatever work is needed to update the page.

1 Like

can we update complete website again and again using web sockets with reload the page. if yes please help sir

Or we have to use AJAX to update UI depending on which changes can be seen

You have lots of options. If you want the whole page to refresh, you still need something in the page deciding to do that.

If you don't want to go the websocket way, then yes, AJAX is the other way of solving the problem. Create a new HTTP In end point that just returns the data rather than the full page - and have some javascript on the page make AJAX requests to see if anything has changed.

There's nothing specific to Node-RED here - you need to decide which method you're most comfortable in using on your webpage and then create the Node-RED flows to support it on the server side.

1 Like

Thank you @knolleary for your support , I will try to implement this. Wish you a good health.

@knolleary Sir the main issue is our webpage is changing but only in debug node. As you can see in the Screen shot we put a debug node in the end of template node , that when we trigger inject node or /tushartest we get the updated html page string in the debug node , "so that means our webpage is updating depending on server data" but we can't see that updated page in URL without reloading, when we reload that page is updated. I will send you two more images which tells you what iwant to change when "Online " and "Offline " data comes from msg.payload.

The above condition i want when online , and when offline i want

I have described the various options you have for making your webpage update itself. Screenshots of the webpage won't change that advice.

There are lots of guides online about how to create a webpage that polls a server for new data. That is not specific to Node-RED.

1 Like

This would be easier using the dashboard ui-template node. all the transmission of updated data is taken care of for you.

better still, as you are writing your own HTML/VUE/svelte/bootstrap/whatever, use uibuilder, it can serve your pages and web sockets are built in for transmission of data / changes,

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.