/
gabelchik
/
nodered
Обзор
Документация
Войти
/
gabelchik
/
nodered
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
node-red-data/flows.json
419 строк
10 KB
Leonid Kalintsev
WebSocket файлы
03 июл 2026, 15:23
03 июл 2026, 15:23
49251d2
Код
Авторство
О чём код?
[ { "id": "b252b8e1682291bf", "type": "tab", "label": "Поток 1", "disabled": false, "info": "", "env": [] }, { "id": "8c015fa6d2ad3f3b", "type": "tab", "label": "Поток 2", "disabled": false, "info": "", "env": [] }, { "id": "0ff06d8f76816ca2", "type": "websocket-listener", "path": "/ws/timestamp", "wholemsg": "false" }, { "id": "eb36e1feb43b7cc5", "type": "http in", "z": "b252b8e1682291bf", "name": "Приём файлов", "url": "/upload", "method": "post", "upload": true, "skipBodyParsing": false, "swaggerDoc": "", "x": 80, "y": 280, "wires": [ [ "da5e95d2a5e0ebf6" ] ] }, { "id": "da5e95d2a5e0ebf6", "type": "switch", "z": "b252b8e1682291bf", "name": "Анализ имени файла", "property": "req.files[0].originalname", "propertyType": "msg", "rules": [ { "t": "regex", "v": "^оптика_\\d{2}-\\d{2}-\\d{4}", "vt": "str", "case": false }, { "t": "regex", "v": "^сплавы_\\d{2}-\\d{2}-\\d{4}", "vt": "str", "case": false }, { "t": "else" } ], "checkall": "true", "repair": false, "outputs": 3, "x": 320, "y": 280, "wires": [ [ "b0178c766c2cc8ad" ], [ "c9789433926e0cb0" ], [ "7839839b8ce47c30" ] ] }, { "id": "40c6eec19fd06e1b", "type": "http response", "z": "b252b8e1682291bf", "name": "Ответ Оптика", "statusCode": "200", "headers": {}, "x": 860, "y": 200, "wires": [] }, { "id": "fc601bfe877c710d", "type": "http response", "z": "b252b8e1682291bf", "name": "Ответ Сплавы", "statusCode": "", "headers": {}, "x": 860, "y": 280, "wires": [] }, { "id": "e904859d92109fd8", "type": "http response", "z": "b252b8e1682291bf", "name": "Ответ Ошибка", "statusCode": "", "headers": {}, "x": 860, "y": 360, "wires": [] }, { "id": "b0178c766c2cc8ad", "type": "change", "z": "b252b8e1682291bf", "name": "", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "Я сервер Оптика, принял файл!", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 610, "y": 200, "wires": [ [ "40c6eec19fd06e1b" ] ] }, { "id": "c9789433926e0cb0", "type": "change", "z": "b252b8e1682291bf", "name": "", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "Я сервер Сплавы, принял файл!", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 610, "y": 280, "wires": [ [ "fc601bfe877c710d" ] ] }, { "id": "7839839b8ce47c30", "type": "change", "z": "b252b8e1682291bf", "name": "", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "Ошибка! Неверный формат имени файла.", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 610, "y": 360, "wires": [ [ "e904859d92109fd8" ] ] }, { "id": "7ecf84456f4188ee", "type": "websocket out", "z": "8c015fa6d2ad3f3b", "name": "WebSocketOUT", "server": "0ff06d8f76816ca2", "client": "", "x": 1300, "y": 260, "wires": [] }, { "id": "0c1d2e9cd1e07c03", "type": "function", "z": "8c015fa6d2ad3f3b", "name": "function 1", "func": "const { optic, alloy, nut } = msg.payload;\n\nconst opticData = JSON.parse(optic);\nconst alloyData = JSON.parse(alloy);\nconst nutData = JSON.parse(nut);\n\nmsg.payload = {\n timestamp: Date.now(),\n formatted: new Date().toISOString(),\n data: {\n Alloy: alloyData,\n Nut: nutData,\n Optic: opticData\n }\n};\n\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1100, "y": 260, "wires": [ [ "7ecf84456f4188ee" ] ] }, { "id": "d88059848b7b64e1", "type": "inject", "z": "8c015fa6d2ad3f3b", "name": "", "props": [], "repeat": "10", "crontab": "", "once": true, "onceDelay": "", "topic": "", "x": 110, "y": 260, "wires": [ [ "258e517fe34d9be2", "efb740a11e9704b2", "2b0666a08403299f" ] ] }, { "id": "258e517fe34d9be2", "type": "file in", "z": "8c015fa6d2ad3f3b", "name": "Чтение гайки", "filename": "/data/files/гайка_09-08-2026.txt", "filenameType": "str", "format": "utf8", "chunk": false, "sendError": false, "encoding": "none", "allProps": false, "x": 340, "y": 180, "wires": [ [ "3d1d1ac24d667e79" ] ] }, { "id": "efb740a11e9704b2", "type": "file in", "z": "8c015fa6d2ad3f3b", "name": "Чтение оптики", "filename": "/data/files/оптика_25-05-2025.txt", "filenameType": "str", "format": "utf8", "chunk": false, "sendError": false, "encoding": "none", "allProps": false, "x": 340, "y": 260, "wires": [ [ "16c0ccc2421c9ef6" ] ] }, { "id": "2b0666a08403299f", "type": "file in", "z": "8c015fa6d2ad3f3b", "name": "Чтение сплавов", "filename": "/data/files/сплавы_01-01-2026.txt", "filenameType": "str", "format": "utf8", "chunk": false, "sendError": false, "encoding": "none", "allProps": false, "x": 350, "y": 340, "wires": [ [ "be6ee1ef74ba6850" ] ] }, { "id": "cb8731aabbb44c20", "type": "join", "z": "8c015fa6d2ad3f3b", "name": "Объединение данных", "mode": "custom", "build": "object", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "useparts": false, "accumulate": false, "timeout": "", "count": "3", "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 870, "y": 260, "wires": [ [ "0c1d2e9cd1e07c03" ] ] }, { "id": "3d1d1ac24d667e79", "type": "change", "z": "8c015fa6d2ad3f3b", "name": "", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "nut", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 580, "y": 180, "wires": [ [ "cb8731aabbb44c20" ] ] }, { "id": "16c0ccc2421c9ef6", "type": "change", "z": "8c015fa6d2ad3f3b", "name": "", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "optic", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 580, "y": 260, "wires": [ [ "cb8731aabbb44c20" ] ] }, { "id": "be6ee1ef74ba6850", "type": "change", "z": "8c015fa6d2ad3f3b", "name": "", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "alloy", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 580, "y": 340, "wires": [ [ "cb8731aabbb44c20" ] ] } ]