Pass message between websocket-in and websocket-out

How to pass message between websocket-in and websocket-out node? I have set a msg.device before websocket-in node and want to get it after websocket-out node, but I got undefined.
I cannot use flow variables to save it, because it will be overwrited if I execute the same flow many times at the same time

There is a built in demo (CTRL-I --> examples --> node-red --> network)

Here is the websocket example adjusted to send/recieve entire message...

Demo Flow (use CTRL-I to import)

[{"id":"13410716.69c9d9","type":"websocket in","z":"d5aee383de79fdc8","name":"","server":"89db22b6.9aa36","client":"","x":1680,"y":240,"wires":[["c2541f10.59544"]]},{"id":"c2541f10.59544","type":"debug","z":"d5aee383de79fdc8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1830,"y":240,"wires":[]},{"id":"6788839e.04576c","type":"inject","z":"d5aee383de79fdc8","name":"device 123","props":[{"p":"payload"},{"p":"device","v":"123","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Hello, World!","payloadType":"str","x":1680,"y":140,"wires":[["438c232a.06c2cc"]]},{"id":"438c232a.06c2cc","type":"websocket out","z":"d5aee383de79fdc8","name":"","server":"","client":"63620788.bda128","x":1900,"y":180,"wires":[]},{"id":"bce24e49dfdf0d40","type":"inject","z":"d5aee383de79fdc8","name":"device 321","props":[{"p":"payload"},{"p":"device","v":"321","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Hello, World!","payloadType":"str","x":1680,"y":180,"wires":[["438c232a.06c2cc"]]},{"id":"89db22b6.9aa36","type":"websocket-listener","path":"/ws1","wholemsg":"true"},{"id":"63620788.bda128","type":"websocket-client","path":"ws://localhost:1880/ws1","tls":"","wholemsg":"true","hb":"0","subprotocol":""}]

Thanks for your reply.Maybe I didn't express clearly. The websocket in and out node connect the outside server, not the server created in node-red

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