Skip to content

Instantly share code, notes, and snippets.

@dceejay
Created February 23, 2015 22:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dceejay/72d92bb5fba32b1bc83c to your computer and use it in GitHub Desktop.
Save dceejay/72d92bb5fba32b1bc83c to your computer and use it in GitHub Desktop.
TCP request example
[{"id":"718554ed.8e7aac","type":"inject","name":"","topic":"","payload":"hello","payloadType":"string","repeat":"","crontab":"","once":false,"x":151,"y":457,"z":"6b5c7d92.94a384","wires":[["31a4d6ce.ce5b2a"]]},{"id":"31a4d6ce.ce5b2a","type":"tcp request","server":"192.168.1.10","port":"55555","out":"time","splitc":"100","name":"","x":353,"y":507,"z":"6b5c7d92.94a384","wires":[["4e62b5b1.b19d4c"]]},{"id":"4e62b5b1.b19d4c","type":"function","name":"only pass changes","func":"\ncontext.old = context.old || \"\";\nmsg.payload = msg.payload.toString();\n\nif (msg.payload !== context.old) {\n context.old = msg.payload;\n return msg;\n}\nreturn null;","outputs":1,"valid":true,"x":551,"y":566,"z":"6b5c7d92.94a384","wires":[["f43c9e61.0bc36"]]},{"id":"253b6ef0.dac492","type":"inject","name":"","topic":"","payload":"goodbye","payloadType":"string","repeat":"","crontab":"","once":true,"x":151,"y":532,"z":"6b5c7d92.94a384","wires":[["31a4d6ce.ce5b2a"]]},{"id":"f43c9e61.0bc36","type":"debug","name":"","active":true,"console":"false","complete":"payload","x":705.5,"y":487,"z":"6b5c7d92.94a384","wires":[]}]
@dceejay
Copy link
Author

dceejay commented Feb 23, 2015

This was just hitting against a tcp echo server on another machine. the response (echo) is then checked in the function node to see if it was different than previous and if so passes the message on...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment