Node-Red和Web套接字

时间:2016-02-17 08:13:26

标签: window node-red

我正在尝试在Windows环境中使用node-red的websockets(我已成功尝试使用Linux)。

我有简单的应用程序,如下图所示

node red - actual deployed node

并且它在控制台上的输出无效:

17 Feb 09:07:04 - [error] [websocket out:c87881cc.37878] TypeError: Cannot read property 'wholemsg' of null

node-red json:

[{
    "id": "50702139.8696e",
    "type": "websocket-client",
    "z": "f00fcb86.2de8f8",
    "path": "/press",
    "wholemsg": "false"
}, {
    "id": "c87881cc.37878",
    "type": "websocket out",
    "z": "f00fcb86.2de8f8",
    "name": "",
    "server": "",
    "client": "50702139.8696e",
    "x": 361,
    "y": 66,
    "wires": []
}, {
    "id": "c99314fe.366ce8",
    "type": "inject",
    "z": "f00fcb86.2de8f8",
    "name": "",
    "topic": "",
    "payload": "",
    "payloadType": "date",
    "repeat": "",
    "crontab": "",
    "once": false,
    "x": 163,
    "y": 67,
    "wires": [["c87881cc.37878"]]
}, {
    "id": "12f91072.ed06f",
    "type": "websocket in",
    "z": "f00fcb86.2de8f8",
    "name": "",
    "server": "",
    "client": "50702139.8696e",
    "x": 162,
    "y": 147,
    "wires": [["62f0f292.9d0f0c"]]
}, {
    "id": "62f0f292.9d0f0c",
    "type": "debug",
    "z": "f00fcb86.2de8f8",
    "name": "",
    "active": true,
    "console": "true",
    "complete": "true",
    "x": 344,
    "y": 147,
    "wires": []
}]

有人有任何想法吗?

1 个答案:

答案 0 :(得分:0)

整个json看起来像是一个数组。在数组的第一个元素中有一个对象,其中是整个对象。地址为node-red json [0] .wholemsg,其中“node-red json”是保存消息的变量名。