So it has come to my attention that instead on a TCP connection, I could use a MQTT node. This should remove my need for buffers. I don't have the PLC node set-up yet (I'm currently playing with this from my computer away from our IoT module). However, the PLC data will be sent to a function where I will take on a topic to the msg. Then, I should be able to send the msg to a MQTT node to be sent to my computer (where I am running mosquitto). Is my understanding of how this works correct? My code is below:
[
{
"id": "3cd910722e16ce1f",
"type": "mqtt out",
"z": "797817a747fe6a25",
"name": "",
"topic": "PLCData",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "407a01e4.6b637",
"x": 580,
"y": 460,
"wires": []
},
{
"id": "afae811ab5ae6cdd",
"type": "s7 in",
"z": "797817a747fe6a25",
"endpoint": "",
"mode": "single",
"variable": "",
"diff": true,
"name": "",
"x": 230,
"y": 420,
"wires": [
[
"3528fb91eb956713"
]
]
},
{
"id": "3528fb91eb956713",
"type": "function",
"z": "797817a747fe6a25",
"name": "Add Topic",
"func": "msg.payload;\nmsg.topic = \"PLCData\";\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 400,
"y": 420,
"wires": [
[
"3cd910722e16ce1f"
]
]
},
{
"id": "407a01e4.6b637",
"type": "mqtt-broker",
"broker": "localhost",
"port": "1883",
"clientid": "",
"usetls": false,
"compatmode": true,
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"willTopic": "",
"willQos": "0",
"willPayload": ""
}
]