diff --git a/packages/node_modules/@node-red/nodes/examples/network/http/01 - Create HTTP endpoint.json b/packages/node_modules/@node-red/nodes/examples/network/http/01 - Create HTTP endpoint.json new file mode 100644 index 000000000..1ff7eb228 --- /dev/null +++ b/packages/node_modules/@node-red/nodes/examples/network/http/01 - Create HTTP endpoint.json @@ -0,0 +1,226 @@ +[ + { + "id": "87bd706a.aec93", + "type": "comment", + "z": "d41b4dd3.ecd6a", + "name": "Create an HTTP Endpoint", + "info": "The `HTTP In` and `HTTP Response` pair of nodes are the starting point for all HTTP endpoints you create.\n\nAny flow that starts with an `HTTP In` node must have a path to an `HTTP Response` node otherwise requests will eventually timeout.\n\nThe `HTTP Response` node uses the `payload` property of messages it receives as the body of the response. Other properties can be used to further customize the response - they are covered in other recipes.\n\nThe `Template` node provides a convenient way to embed a body of content into a flow. It may be desirable to maintain such static content outside of the flow.\n\nSee Node-RED cookbook [item](https://cookbook.nodered.org/http/create-an-http-endpoint) for details.", + "x": 230, + "y": 100, + "wires": [] + }, + { + "id": "7f10afe.b1faa5", + "type": "http in", + "z": "d41b4dd3.ecd6a", + "name": "", + "url": "/hello", + "method": "get", + "upload": false, + "swaggerDoc": "", + "x": 240, + "y": 140, + "wires": [ + [ + "db134063.83b7a" + ] + ] + }, + { + "id": "d5ce67fc.e6e608", + "type": "http response", + "z": "d41b4dd3.ecd6a", + "name": "", + "statusCode": "", + "headers": {}, + "x": 490, + "y": 140, + "wires": [] + }, + { + "id": "5a89ce70.db6d5", + "type": "http request", + "z": "d41b4dd3.ecd6a", + "name": "", + "method": "GET", + "ret": "txt", + "paytoqs": "ignore", + "url": "http://localhost:1880/hello", + "tls": "", + "persist": false, + "proxy": "", + "authType": "", + "x": 390, + "y": 280, + "wires": [ + [ + "18b48ed8.1072e1" + ] + ] + }, + { + "id": "31f7aabb.3fbe06", + "type": "inject", + "z": "d41b4dd3.ecd6a", + "name": "", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "", + "payloadType": "date", + "x": 240, + "y": 280, + "wires": [ + [ + "5a89ce70.db6d5" + ] + ] + }, + { + "id": "18b48ed8.1072e1", + "type": "debug", + "z": "d41b4dd3.ecd6a", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "statusVal": "", + "statusType": "auto", + "x": 550, + "y": 280, + "wires": [] + }, + { + "id": "3c61c12c.5abaae", + "type": "comment", + "z": "d41b4dd3.ecd6a", + "name": "Send HTTP request: http://localhost:1880/hello", + "info": "`http request` node can be used to make an **HTTP GET** request.\n\nSee Node-RED cookbook [item](https://cookbook.nodered.org/http/simple-get-request) for details.", + "x": 300, + "y": 200, + "wires": [] + }, + { + "id": "db134063.83b7a", + "type": "template", + "z": "d41b4dd3.ecd6a", + "name": "page", + "field": "payload", + "fieldType": "msg", + "format": "html", + "syntax": "mustache", + "template": "\n
\n \n{{ payload }}\n \n", + "output": "str", + "x": 650, + "y": 2200, + "wires": [ + [ + "f52e2880.180968" + ] + ] + }, + { + "id": "f52e2880.180968", + "type": "http response", + "z": "d41b4dd3.ecd6a", + "name": "", + "x": 870, + "y": 2200, + "wires": [] + }, + { + "id": "9a2a9a4.0fc0768", + "type": "change", + "z": "d41b4dd3.ecd6a", + "name": "Redirect to /hello-cookie", + "rules": [ + { + "t": "set", + "p": "statusCode", + "pt": "msg", + "to": "302", + "tot": "num" + }, + { + "t": "set", + "p": "headers", + "pt": "msg", + "to": "{}", + "tot": "json" + }, + { + "t": "set", + "p": "headers.location", + "pt": "msg", + "to": "/hello-cookie", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 670, + "y": 2260, + "wires": [ + [ + "f52e2880.180968" + ] + ] + }, + { + "id": "afefb90.53dcf48", + "type": "function", + "z": "d41b4dd3.ecd6a", + "name": "Add a cookie", + "func": "msg.cookies = { };\nmsg.cookies[\"demo-\"+(Math.floor(Math.random()*1000))] = Date.now();\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 450, + "y": 2240, + "wires": [ + [ + "9a2a9a4.0fc0768" + ] + ] + }, + { + "id": "d5205a2c.db9018", + "type": "function", + "z": "d41b4dd3.ecd6a", + "name": "Clear cookies", + "func": "// Find demo cookies and clear them\nvar cookieNames = Object.keys(msg.req.cookies).filter(function(cookieName) { return /^demo-/.test(cookieName);});\nmsg.cookies = {};\n\ncookieNames.forEach(function(cookieName) {\n msg.cookies[cookieName] = null;\n});\n\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 460, + "y": 2280, + "wires": [ + [ + "9a2a9a4.0fc0768" + ] + ] + }, + { + "id": "fda60c66.04975", + "type": "http in", + "z": "d41b4dd3.ecd6a", + "name": "", + "url": "/hello-cookie/add", + "method": "get", + "swaggerDoc": "", + "x": 260, + "y": 2240, + "wires": [ + [ + "afefb90.53dcf48" + ] + ] + }, + { + "id": "35285a76.1f8636", + "type": "http in", + "z": "d41b4dd3.ecd6a", + "name": "", + "url": "/hello-cookie/clear", + "method": "get", + "swaggerDoc": "", + "x": 260, + "y": 2280, + "wires": [ + [ + "d5205a2c.db9018" + ] + ] + }, + { + "id": "cb094c2f.7e34d", + "type": "comment", + "z": "d41b4dd3.ecd6a", + "name": "Working with cookies", + "info": "The messages sent by the `HTTP In` node include the `msg.req.cookies` property that lists the cookies set on the current request.\n\nThe `HTTP Response` node will use the `msg.cookies` property in order to set or clear cookies.\n\nSee Node-RED cookbook [item](https://cookbook.nodered.org/http/work-with-cookies) for details.\n", + "x": 220, + "y": 2100, + "wires": [] + }, + { + "id": "287a9146.683afe", + "type": "comment", + "z": "d41b4dd3.ecd6a", + "name": "Create HTTP page for testing cookies: open http://localhost:1880/hello-cookie from Web browser. ", + "info": "", + "x": 500, + "y": 2160, + "wires": [] + } +] \ No newline at end of file diff --git a/packages/node_modules/@node-red/nodes/examples/network/tcp/01 - Connect to TCP out server.json b/packages/node_modules/@node-red/nodes/examples/network/tcp/01 - Connect to TCP out server.json new file mode 100644 index 000000000..78c24760c --- /dev/null +++ b/packages/node_modules/@node-red/nodes/examples/network/tcp/01 - Connect to TCP out server.json @@ -0,0 +1,92 @@ +[ + { + "id": "73874b9e.d985b4", + "type": "tcp in", + "z": "cfd9159c.6f73e8", + "name": "", + "server": "client", + "host": "localhost", + "port": "1881", + "datamode": "single", + "datatype": "utf8", + "newline": "", + "topic": "", + "base64": false, + "x": 230, + "y": 240, + "wires": [ + [ + "ce332113.d2c31" + ] + ] + }, + { + "id": "a4bd9948.dfeb58", + "type": "tcp out", + "z": "cfd9159c.6f73e8", + "host": "localhost", + "port": "1881", + "beserver": "server", + "base64": false, + "end": true, + "name": "", + "x": 390, + "y": 180, + "wires": [] + }, + { + "id": "9f80f9c7.1e3c98", + "type": "inject", + "z": "cfd9159c.6f73e8", + "name": "", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "Hello, World!", + "payloadType": "str", + "x": 210, + "y": 180, + "wires": [ + [ + "a4bd9948.dfeb58" + ] + ] + }, + { + "id": "ce332113.d2c31", + "type": "debug", + "z": "cfd9159c.6f73e8", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "statusVal": "", + "statusType": "auto", + "x": 410, + "y": 240, + "wires": [] + }, + { + "id": "711ed10d.1d765", + "type": "comment", + "z": "cfd9159c.6f73e8", + "name": "Connect to TCP out server", + "info": "`TCP in` node can connect to network server using tcp protocol. `TCP out` node can serve a network server using tcp procol.\n", + "x": 190, + "y": 120, + "wires": [] + } +] \ No newline at end of file diff --git a/packages/node_modules/@node-red/nodes/examples/network/tcp/02 - Connect to TCP in server.json b/packages/node_modules/@node-red/nodes/examples/network/tcp/02 - Connect to TCP in server.json new file mode 100644 index 000000000..357cbb9ca --- /dev/null +++ b/packages/node_modules/@node-red/nodes/examples/network/tcp/02 - Connect to TCP in server.json @@ -0,0 +1,92 @@ +[ + { + "id": "511f8208.c4c20c", + "type": "tcp in", + "z": "cfd9159c.6f73e8", + "name": "", + "server": "server", + "host": "localhost", + "port": "1882", + "datamode": "single", + "datatype": "utf8", + "newline": "", + "topic": "", + "base64": false, + "x": 230, + "y": 460, + "wires": [ + [ + "6b8be121.32be9" + ] + ] + }, + { + "id": "ec0bc4aa.b3c828", + "type": "tcp out", + "z": "cfd9159c.6f73e8", + "host": "localhost", + "port": "1882", + "beserver": "client", + "base64": false, + "end": true, + "name": "", + "x": 390, + "y": 400, + "wires": [] + }, + { + "id": "17cf7d56.9efb03", + "type": "inject", + "z": "cfd9159c.6f73e8", + "name": "", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "Hello, World!", + "payloadType": "str", + "x": 210, + "y": 400, + "wires": [ + [ + "ec0bc4aa.b3c828" + ] + ] + }, + { + "id": "6b8be121.32be9", + "type": "debug", + "z": "cfd9159c.6f73e8", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "statusVal": "", + "statusType": "auto", + "x": 410, + "y": 460, + "wires": [] + }, + { + "id": "76196665.7c23e8", + "type": "comment", + "z": "cfd9159c.6f73e8", + "name": "Connect to TCP in server", + "info": "`TCP out` node can connect to network server using tcp protocol. `TCP in` node can serve a network server using tcp procol.\n", + "x": 190, + "y": 340, + "wires": [] + } +] \ No newline at end of file diff --git a/packages/node_modules/@node-red/nodes/examples/network/tcp/03 - Send reply to client of TCP connection.json b/packages/node_modules/@node-red/nodes/examples/network/tcp/03 - Send reply to client of TCP connection.json new file mode 100644 index 000000000..b4a324261 --- /dev/null +++ b/packages/node_modules/@node-red/nodes/examples/network/tcp/03 - Send reply to client of TCP connection.json @@ -0,0 +1,174 @@ +[ + { + "id": "d9a91d7e.05f0d", + "type": "tcp in", + "z": "cfd9159c.6f73e8", + "name": "", + "server": "server", + "host": "localhost", + "port": "1883", + "datamode": "stream", + "datatype": "utf8", + "newline": "¥n", + "topic": "", + "base64": false, + "x": 230, + "y": 740, + "wires": [ + [ + "3871d8af.25e208" + ] + ] + }, + { + "id": "9fa8f09d.7591b", + "type": "inject", + "z": "cfd9159c.6f73e8", + "name": "", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "\"Hello, World!¥n\"", + "payloadType": "jsonata", + "x": 190, + "y": 640, + "wires": [ + [ + "948a8410.ab0a08" + ] + ] + }, + { + "id": "33df08b.753e9f8", + "type": "debug", + "z": "cfd9159c.6f73e8", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "statusVal": "", + "statusType": "auto", + "x": 710, + "y": 640, + "wires": [] + }, + { + "id": "948a8410.ab0a08", + "type": "tcp request", + "z": "cfd9159c.6f73e8", + "server": "localhost", + "port": "1883", + "out": "char", + "splitc": "\\n", + "name": "", + "x": 350, + "y": 640, + "wires": [ + [ + "f6d6be6a.efb4c" + ] + ] + }, + { + "id": "fbd442d8.cb273", + "type": "tcp out", + "z": "cfd9159c.6f73e8", + "host": "", + "port": "", + "beserver": "reply", + "base64": false, + "end": false, + "name": "", + "x": 530, + "y": 740, + "wires": [] + }, + { + "id": "3871d8af.25e208", + "type": "change", + "z": "cfd9159c.6f73e8", + "name": "set result", + "rules": [ + { + "t": "set", + "p": "payload", + "pt": "msg", + "to": "\"Received: \" & payload & \"\b\\n\"", + "tot": "jsonata" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 400, + "y": 740, + "wires": [ + [ + "fbd442d8.cb273" + ] + ] + }, + { + "id": "f6d6be6a.efb4c", + "type": "function", + "z": "cfd9159c.6f73e8", + "name": "Buffer to String", + "func": "msg.payload = msg.payload.toString();\nreturn msg;", + "outputs": 1, + "noerr": 0, + "initialize": "", + "finalize": "", + "x": 540, + "y": 640, + "wires": [ + [ + "33df08b.753e9f8" + ] + ] + }, + { + "id": "e1412987.91dcc8", + "type": "comment", + "z": "cfd9159c.6f73e8", + "name": "Send reply to client of TCP connection", + "info": "Input message from `TCP in` node may be passed to `TCP out` node to return a reply to client.\n", + "x": 230, + "y": 580, + "wires": [] + }, + { + "id": "5f43905f.2425d", + "type": "comment", + "z": "cfd9159c.6f73e8", + "name": "↓ Accept request", + "info": "", + "x": 220, + "y": 700, + "wires": [] + }, + { + "id": "a6f57329.c87c6", + "type": "comment", + "z": "cfd9159c.6f73e8", + "name": "↓ Reply result", + "info": "", + "x": 550, + "y": 700, + "wires": [] + } +] \ No newline at end of file diff --git a/packages/node_modules/@node-red/nodes/examples/network/udp/01 - Transfer data using UDP protocol.json b/packages/node_modules/@node-red/nodes/examples/network/udp/01 - Transfer data using UDP protocol.json new file mode 100644 index 000000000..d53a05da8 --- /dev/null +++ b/packages/node_modules/@node-red/nodes/examples/network/udp/01 - Transfer data using UDP protocol.json @@ -0,0 +1,92 @@ +[ + { + "id": "73279b5.5151664", + "type": "udp in", + "z": "92236e19.9e4cb", + "name": "", + "iface": "", + "port": "1881", + "ipv": "udp4", + "multicast": "false", + "group": "", + "datatype": "utf8", + "x": 220, + "y": 220, + "wires": [ + [ + "d98b60d3.7331e" + ] + ] + }, + { + "id": "fb19b98f.d5aa58", + "type": "udp out", + "z": "92236e19.9e4cb", + "name": "", + "addr": "localhost", + "iface": "", + "port": "1881", + "ipv": "udp4", + "outport": "", + "base64": false, + "multicast": "false", + "x": 410, + "y": 160, + "wires": [] + }, + { + "id": "33f18897.35d5b8", + "type": "inject", + "z": "92236e19.9e4cb", + "name": "", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "Hello, World!", + "payloadType": "str", + "x": 230, + "y": 160, + "wires": [ + [ + "fb19b98f.d5aa58" + ] + ] + }, + { + "id": "d98b60d3.7331e", + "type": "debug", + "z": "92236e19.9e4cb", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "statusVal": "", + "statusType": "auto", + "x": 370, + "y": 220, + "wires": [] + }, + { + "id": "f86495aa.8a9848", + "type": "comment", + "z": "92236e19.9e4cb", + "name": "Transfer data using UDP protocol", + "info": "`UDP in` node can be used to receive data from `UDP out` node using UDP protocol.", + "x": 230, + "y": 100, + "wires": [] + } +] \ No newline at end of file diff --git a/packages/node_modules/@node-red/nodes/examples/network/websocket/01 - Connect to websocket in server.json b/packages/node_modules/@node-red/nodes/examples/network/websocket/01 - Connect to websocket in server.json new file mode 100644 index 000000000..5abc5c223 --- /dev/null +++ b/packages/node_modules/@node-red/nodes/examples/network/websocket/01 - Connect to websocket in server.json @@ -0,0 +1,96 @@ +[ + { + "id": "13410716.69c9d9", + "type": "websocket in", + "z": "a8360b47.074ec8", + "name": "", + "server": "89db22b6.9aa36", + "client": "", + "x": 280, + "y": 180, + "wires": [ + [ + "c2541f10.59544" + ] + ] + }, + { + "id": "c2541f10.59544", + "type": "debug", + "z": "a8360b47.074ec8", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "statusVal": "", + "statusType": "auto", + "x": 430, + "y": 180, + "wires": [] + }, + { + "id": "6788839e.04576c", + "type": "inject", + "z": "a8360b47.074ec8", + "name": "", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "Hello, World!", + "payloadType": "str", + "x": 290, + "y": 120, + "wires": [ + [ + "438c232a.06c2cc" + ] + ] + }, + { + "id": "438c232a.06c2cc", + "type": "websocket out", + "z": "a8360b47.074ec8", + "name": "", + "server": "", + "client": "63620788.bda128", + "x": 500, + "y": 120, + "wires": [] + }, + { + "id": "c88f97a9.4410f8", + "type": "comment", + "z": "a8360b47.074ec8", + "name": "Connect to websocket in server", + "info": "`websocket out` node can connect to web socket server. `websocket in` node can serve a web socket server.\n", + "x": 290, + "y": 80, + "wires": [] + }, + { + "id": "89db22b6.9aa36", + "type": "websocket-listener", + "path": "/ws1", + "wholemsg": "false" + }, + { + "id": "63620788.bda128", + "type": "websocket-client", + "path": "ws://localhost:1880/ws1", + "tls": "", + "wholemsg": "false" + } +] \ No newline at end of file diff --git a/packages/node_modules/@node-red/nodes/examples/network/websocket/02 - Connect to websocket out server.json b/packages/node_modules/@node-red/nodes/examples/network/websocket/02 - Connect to websocket out server.json new file mode 100644 index 000000000..667af1a95 --- /dev/null +++ b/packages/node_modules/@node-red/nodes/examples/network/websocket/02 - Connect to websocket out server.json @@ -0,0 +1,96 @@ +[ + { + "id": "759c0b2b.8a0484", + "type": "websocket in", + "z": "a8360b47.074ec8", + "name": "", + "server": "", + "client": "1d80bd86.93f372", + "x": 340, + "y": 520, + "wires": [ + [ + "1f7a7454.cb65ec" + ] + ] + }, + { + "id": "1f7a7454.cb65ec", + "type": "debug", + "z": "a8360b47.074ec8", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "statusVal": "", + "statusType": "auto", + "x": 550, + "y": 520, + "wires": [] + }, + { + "id": "aa2fe781.e92b28", + "type": "inject", + "z": "a8360b47.074ec8", + "name": "", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "Goodbye, World!", + "payloadType": "str", + "x": 300, + "y": 460, + "wires": [ + [ + "f8bdbc9b.d82dd" + ] + ] + }, + { + "id": "f8bdbc9b.d82dd", + "type": "websocket out", + "z": "a8360b47.074ec8", + "name": "", + "server": "40bd4295.3e4ecc", + "client": "", + "x": 460, + "y": 460, + "wires": [] + }, + { + "id": "c3fbc602.2e7f08", + "type": "comment", + "z": "a8360b47.074ec8", + "name": "Connect to websocket out server", + "info": "`websocket out` node can connect to web socket server. `websocket in` node can serve a web socket server.\n", + "x": 290, + "y": 420, + "wires": [] + }, + { + "id": "1d80bd86.93f372", + "type": "websocket-client", + "path": "ws://localhost:1880/ws2", + "tls": "", + "wholemsg": "false" + }, + { + "id": "40bd4295.3e4ecc", + "type": "websocket-listener", + "path": "/ws2", + "wholemsg": "false" + } +] \ No newline at end of file