Connecting Python to a webpage via node-red
Please check your settings.js
file — do you have a url prefix defined for either httpRoot
or httpNodeRoot
?
For instance, in my project, when I add a new websocket config node, this info box is shown:
By default, payload will contain the data to be sent over, or received from a
websocket. The listener can be configured to send or receive the entire message
object as a JSON formatted string. This path will be relative to/red
.
If so, I believe you will have to modify the url in your python code, like so:
ws.connect("ws://localhost:1880/red/ws/example")
substituting your prefix, of course…
Read more here: Source link