Last active
October 23, 2019 16:28
-
-
Save paulhayes/57c77833e6806de4a4de94532fe3758a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id": "68139e86.85018", | |
"type": "tcp in", | |
"z": "d29d489d.a5eb08", | |
"name": "tcp in", | |
"server": "server", | |
"host": "", | |
"port": "9000", | |
"datamode": "stream", | |
"datatype": "utf8", | |
"newline": "\\n", | |
"topic": "", | |
"base64": false, | |
"x": 290, | |
"y": 520, | |
"wires": [ | |
[ | |
"63c6d0c3.6ff95" | |
] | |
] | |
}, | |
{ | |
"id": "63c6d0c3.6ff95", | |
"type": "debug", | |
"z": "d29d489d.a5eb08", | |
"name": "", | |
"active": true, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "false", | |
"x": 470, | |
"y": 520, | |
"wires": [] | |
}, | |
{ | |
"id": "a15fb31b.bd63d", | |
"type": "inject", | |
"z": "d29d489d.a5eb08", | |
"name": "", | |
"topic": "", | |
"payload": "test\\n", | |
"payloadType": "str", | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"onceDelay": 0.1, | |
"x": 190, | |
"y": 620, | |
"wires": [ | |
[ | |
"4793bfbf.abf35" | |
] | |
] | |
}, | |
{ | |
"id": "910db0cb.357d5", | |
"type": "tcp out", | |
"z": "d29d489d.a5eb08", | |
"host": "0.0.0.0", | |
"port": "9000", | |
"beserver": "reply", | |
"base64": false, | |
"end": false, | |
"name": "tcp out", | |
"x": 510, | |
"y": 620, | |
"wires": [] | |
}, | |
{ | |
"id": "4793bfbf.abf35", | |
"type": "function", | |
"z": "d29d489d.a5eb08", | |
"name": "get session", | |
"func": "msg._session = flow.get(\"session\");\nif(msg._session){\n return msg;\n}\n", | |
"outputs": 1, | |
"noerr": 0, | |
"x": 350, | |
"y": 620, | |
"wires": [ | |
[ | |
"910db0cb.357d5" | |
] | |
] | |
}, | |
{ | |
"id": "e53045d1.18d088", | |
"type": "status", | |
"z": "d29d489d.a5eb08", | |
"name": "", | |
"scope": [ | |
"68139e86.85018", | |
"910db0cb.357d5" | |
], | |
"x": 200, | |
"y": 760, | |
"wires": [ | |
[ | |
"4c81d754.4b04b8" | |
] | |
] | |
}, | |
{ | |
"id": "b33a20c5.56413", | |
"type": "debug", | |
"z": "d29d489d.a5eb08", | |
"name": "", | |
"active": true, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "status", | |
"targetType": "msg", | |
"x": 630, | |
"y": 760, | |
"wires": [] | |
}, | |
{ | |
"id": "4c81d754.4b04b8", | |
"type": "function", | |
"z": "d29d489d.a5eb08", | |
"name": "store current session", | |
"func": "var output = [null,null]\n\nif( msg.status.event === \"connect\" ){\n flow.set(\"session\",msg.status._session);\n output[0] = msg;\n}\nelse if( msg.status.event === \"disconnect\" ){\n flow.set(\"session\",null);\n output[1] = msg;\n}\nreturn output;", | |
"outputs": 2, | |
"noerr": 0, | |
"x": 400, | |
"y": 760, | |
"wires": [ | |
[ | |
"b33a20c5.56413" | |
], | |
[ | |
"b33a20c5.56413" | |
] | |
] | |
}, | |
{ | |
"id": "8df0992f.8c9bd8", | |
"type": "comment", | |
"z": "d29d489d.a5eb08", | |
"name": " connection status msg", | |
"info": "", | |
"x": 240, | |
"y": 720, | |
"wires": [] | |
}, | |
{ | |
"id": "34b124ef.08fc9c", | |
"type": "comment", | |
"z": "d29d489d.a5eb08", | |
"name": "send test message", | |
"info": "", | |
"x": 210, | |
"y": 580, | |
"wires": [] | |
}, | |
{ | |
"id": "6e951944.d52b18", | |
"type": "comment", | |
"z": "d29d489d.a5eb08", | |
"name": "log incoming message", | |
"info": "", | |
"x": 340, | |
"y": 480, | |
"wires": [] | |
} | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const net = require('net'); | |
var connection = net.createConnection(9000,"127.0.0.1",function(e){ connection | |
.write("connected\n"); connection.on("data",function(m){ console.log(m.toString( | |
)) }) }); | |
connection.write("test\n"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment