Hello everyone,
I have some strange behaviour with the flow.get function. This function changes the context data, although I actually only want to read it out. Is it intended to do so? Is there a way that the context data remains unchanged?
Heres some sample code:
[{"id":"b3653d879155d2f6","type":"change","z":"fd0dd2d5871eaf24","name":"flow.Test","rules":[{"t":"set","p":"Test.payload","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":920,"y":540,"wires":[["b25113f5c23eb568"]]},{"id":"b25113f5c23eb568","type":"function","z":"fd0dd2d5871eaf24","name":"","func":"// Safe clientId (incoming requests from Front-End)\nlet clientId = false;\nif (msg.hasOwnProperty('_socketId')) clientId = msg._socketId;\n\n// Clear incoming msg-Object\nmsg = {};\n\n// get Flow-Data\nmsg = flow.get(\"Test\");\nmsg.topic = \"test/currentdata\";\n\n// Attach SocketID to msg-Object\nif (clientId) msg._socketId = clientId;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1080,"y":540,"wires":[["3b8788620f01b367"]]},{"id":"c039cb90d75d2ae4","type":"inject","z":"fd0dd2d5871eaf24","name":"Front-End Data","props":[{"p":"payload.topic","v":"test/get/currentdata","vt":"str"},{"p":"_socketId","v":"RaNdOMsOCkeTiD","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":900,"y":580,"wires":[["b25113f5c23eb568"]]},{"id":"3b8788620f01b367","type":"debug","z":"fd0dd2d5871eaf24","name":"Test-Debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1250,"y":540,"wires":[]},{"id":"ac26934567734e2f","type":"inject","z":"fd0dd2d5871eaf24","name":"API-Data","props":[{"p":"payload"},{"p":"notneeded","v":"data","vt":"str"},{"p":"other","v":"data","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"actual payload","payloadType":"str","x":760,"y":540,"wires":[["b3653d879155d2f6"]]}]