TCP client 'mapping'

hello!

I have a set-up in which I like route traffic from several TCP clients. Node-Red will be the 'server' or listener.

The clients B,C,D are sending their status every second. All the statusses should reach client A.

When client A sends a command it should reach clients B,C,D.

Currently I trying a solution in which I have two servers, but command I am sending (from clientA) is still being mirrored back to client A since the TCP node says "reply to all open connections" for some reason it does not stick to the msg._session which should define which node to reply to.

Is there way to 'route' the the traffic with the TCP node?

I made all the connections in 1 flow for testing like this:

[{"id":"a19c2310.149fc","type":"tab","label":"Test-TCP-Server","disabled":false,"info":""},{"id":"969495d0.a50b58","type":"tcp in","z":"a19c2310.149fc","name":"Server holding connections at :1025","server":"server","host":"192.168.5.1","port":"1025","datamode":"stream","datatype":"utf8","newline":"\\n","topic":"text","base64":false,"x":220,"y":140,"wires":[["26631b8.a2b34e4","8fb9eb42.e02ba8"]]},{"id":"5070d317.8b1f4c","type":"tcp out","z":"a19c2310.149fc","host":"","port":"","beserver":"reply","base64":false,"end":false,"name":"reply: all open connections will be messaged","x":1030,"y":380,"wires":[]},{"id":"bf40dabe.a33508","type":"template","z":"a19c2310.149fc","name":"+ newline","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload}}\n","output":"str","x":600,"y":460,"wires":[["5070d317.8b1f4c"]]},{"id":"6e3aa9f8.ab31c8","type":"inject","z":"a19c2310.149fc","name":"S01,01,01,80 ","topic":"","payload":"incoming data","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"","x":150,"y":460,"wires":[["bf40dabe.a33508"]]},{"id":"79845b2d.eb25c4","type":"tcp in","z":"a19c2310.149fc","name":"Server holding connections at :1024","server":"server","host":"192.168.5.1","port":"1024","datamode":"stream","datatype":"utf8","newline":"\\n","topic":"text","base64":false,"x":220,"y":380,"wires":[["8add5f97.fd8ad","66f457eb.de0af8","2de846f7.d6605a"]]},{"id":"8add5f97.fd8ad","type":"debug","z":"a19c2310.149fc","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":590,"y":320,"wires":[]},{"id":"66f457eb.de0af8","type":"debug","z":"a19c2310.149fc","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"_session","targetType":"msg","x":600,"y":280,"wires":[]},{"id":"26631b8.a2b34e4","type":"template","z":"a19c2310.149fc","name":"modify received msg to be send back","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"You were sending: {{payload}}\n","x":670,"y":140,"wires":[["5a1ed420.ba5fdc"]]},{"id":"5a1ed420.ba5fdc","type":"tcp out","z":"a19c2310.149fc","host":"","port":"","beserver":"reply","base64":false,"end":false,"name":"reply: all open connections will be messaged","x":1050,"y":140,"wires":[]},{"id":"8fb9eb42.e02ba8","type":"debug","z":"a19c2310.149fc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":590,"y":80,"wires":[]},{"id":"2de846f7.d6605a","type":"template","z":"a19c2310.149fc","name":"_session parser","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"","x":600,"y":380,"wires":[["5070d317.8b1f4c"]]},{"id":"5b3b7f02.78732","type":"tcp in","z":"a19c2310.149fc","name":"connect 1025","server":"client","host":"localhost","port":"1025","datamode":"stream","datatype":"buffer","newline":"","topic":"text","base64":false,"x":150,"y":700,"wires":[["7b957f0.420838","90b08470.1e0d38"]]},{"id":"7b957f0.420838","type":"debug","z":"a19c2310.149fc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":490,"y":680,"wires":[]},{"id":"51b5ee44.93ad9","type":"template","z":"a19c2310.149fc","name":"+ newline","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload}}\n","output":"str","x":480,"y":800,"wires":[["912b83d9.e91f8"]]},{"id":"5ca7fef6.7bbfa","type":"inject","z":"a19c2310.149fc","name":"button: create a msg","topic":"","payload":"Hello from THE client.","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"","x":170,"y":800,"wires":[["51b5ee44.93ad9"]]},{"id":"912b83d9.e91f8","type":"tcp out","z":"a19c2310.149fc","host":"","port":"","beserver":"reply","base64":false,"end":false,"name":"","x":770,"y":780,"wires":[]},{"id":"90b08470.1e0d38","type":"template","z":"a19c2310.149fc","name":"no msg back","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"","x":490,"y":740,"wires":[["912b83d9.e91f8"]]},{"id":"b458fb6b.d39f68","type":"tcp in","z":"a19c2310.149fc","name":"connect 1024","server":"client","host":"localhost","port":"1024","datamode":"stream","datatype":"buffer","newline":"","topic":"text","base64":false,"x":150,"y":940,"wires":[["f7d287a6.7e0368","6d4e7bd.530c484"]]},{"id":"f7d287a6.7e0368","type":"debug","z":"a19c2310.149fc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":490,"y":920,"wires":[]},{"id":"61bb9645.01db48","type":"template","z":"a19c2310.149fc","name":"+ newline","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload}}\n","output":"str","x":480,"y":1040,"wires":[["521e0173.3513"]]},{"id":"8ae67a39.935b68","type":"inject","z":"a19c2310.149fc","name":"button: create a msg","topic":"","payload":"Hello from THE client.","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"","x":170,"y":1040,"wires":[["61bb9645.01db48"]]},{"id":"521e0173.3513","type":"tcp out","z":"a19c2310.149fc","host":"","port":"","beserver":"reply","base64":false,"end":false,"name":"","x":770,"y":1020,"wires":[]},{"id":"6d4e7bd.530c484","type":"template","z":"a19c2310.149fc","name":"no msg back","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"","x":490,"y":980,"wires":[["521e0173.3513"]]}]

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