node-red-contrib-tcp-client-server-avd 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NodeRedTCP/README.md +408 -0
- package/NodeRedTCP/SPECIFICATIE.md +460 -0
- package/NodeRedTCP/nodes/tcp-client-server-avd.html +298 -0
- package/NodeRedTCP/nodes/tcp-client-server-avd.js +606 -0
- package/NodeRedTCP/package.json +32 -0
- package/README.md +355 -0
- package/SPECIFICATIE.md +402 -0
- package/nodes/tcp-client-server.html +298 -0
- package/nodes/tcp-client-server.js +606 -0
- package/package.json +27 -0
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
<script type="text/javascript">
|
|
2
|
+
RED.nodes.registerType('tcp-client-server-avd', {
|
|
3
|
+
category: 'network',
|
|
4
|
+
color: '#3b82f6',
|
|
5
|
+
defaults: {
|
|
6
|
+
name: { value: "" },
|
|
7
|
+
mode: { value: "client", required: true },
|
|
8
|
+
// Client configuratie
|
|
9
|
+
clientHost: { value: "localhost" },
|
|
10
|
+
clientPort: { value: 8080, validate: function(v) { return /^\d+$/.test(v) && v > 0 && v < 65536; } },
|
|
11
|
+
clientIpVersion: { value: "4" },
|
|
12
|
+
clientAutoConnect: { value: true },
|
|
13
|
+
clientReconnect: { value: true },
|
|
14
|
+
clientReconnectInterval: { value: 5, validate: function(v) { return /^\d+$/.test(v) && v >= 0; } },
|
|
15
|
+
clientMaxReconnectAttempts: { value: 0, validate: function(v) { return /^\d+$/.test(v) && v >= 0; } },
|
|
16
|
+
clientConnectionTimeout: { value: 10, validate: function(v) { return /^\d+$/.test(v) && v > 0; } },
|
|
17
|
+
clientInputFormat: { value: "string" },
|
|
18
|
+
clientOutputFormat: { value: "string" },
|
|
19
|
+
clientEncoding: { value: "utf8" },
|
|
20
|
+
clientDelimiter: { value: "" },
|
|
21
|
+
clientKeepAlive: { value: false },
|
|
22
|
+
// Server configuratie
|
|
23
|
+
serverPort: { value: 8080, validate: function(v) { return /^\d+$/.test(v) && v > 0 && v < 65536; } },
|
|
24
|
+
serverBindAddress: { value: "0.0.0.0" },
|
|
25
|
+
serverIpVersion: { value: "4" },
|
|
26
|
+
serverAutoStart: { value: true },
|
|
27
|
+
serverMaxConnections: { value: 0, validate: function(v) { return /^\d+$/.test(v) && v >= 0; } },
|
|
28
|
+
serverConnectionTimeout: { value: 600, validate: function(v) { return /^\d+$/.test(v) && v > 0; } },
|
|
29
|
+
serverInputFormat: { value: "string" },
|
|
30
|
+
serverOutputFormat: { value: "string" },
|
|
31
|
+
serverEncoding: { value: "utf8" },
|
|
32
|
+
serverDelimiter: { value: "" },
|
|
33
|
+
serverKeepAlive: { value: false }
|
|
34
|
+
},
|
|
35
|
+
inputs: 1,
|
|
36
|
+
outputs: 1,
|
|
37
|
+
icon: "font-awesome/fa-plug",
|
|
38
|
+
label: function() {
|
|
39
|
+
return this.name || "TCP " + (this.mode === "client" ? "Client" : this.mode === "server" ? "Server" : "Client/Server");
|
|
40
|
+
},
|
|
41
|
+
labelStyle: function() {
|
|
42
|
+
return this.name ? "node_label_italic" : "";
|
|
43
|
+
},
|
|
44
|
+
oneditprepare: function() {
|
|
45
|
+
// Toggle visibility van client/server configuratie gebaseerd op mode
|
|
46
|
+
$("#node-input-mode").on("change", function() {
|
|
47
|
+
var mode = $(this).val();
|
|
48
|
+
if (mode === "client") {
|
|
49
|
+
$(".client-config").show();
|
|
50
|
+
$(".server-config").hide();
|
|
51
|
+
} else if (mode === "server") {
|
|
52
|
+
$(".client-config").hide();
|
|
53
|
+
$(".server-config").show();
|
|
54
|
+
} else {
|
|
55
|
+
$(".client-config").show();
|
|
56
|
+
$(".server-config").show();
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
// Trigger initial state
|
|
60
|
+
$("#node-input-mode").trigger("change");
|
|
61
|
+
},
|
|
62
|
+
oneditsave: function() {
|
|
63
|
+
// Validatie kan hier worden toegevoegd
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
<script type="text/html" data-template-name="tcp-client-server-avd">
|
|
69
|
+
<div class="form-row">
|
|
70
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Naam</label>
|
|
71
|
+
<input type="text" id="node-input-name" placeholder="Naam">
|
|
72
|
+
</div>
|
|
73
|
+
|
|
74
|
+
<div class="form-row">
|
|
75
|
+
<label for="node-input-mode"><i class="fa fa-cog"></i> Mode</label>
|
|
76
|
+
<select id="node-input-mode" style="width: 70%;">
|
|
77
|
+
<option value="client">TCP Client</option>
|
|
78
|
+
<option value="server">TCP Server</option>
|
|
79
|
+
<option value="both">TCP Client & Server</option>
|
|
80
|
+
</select>
|
|
81
|
+
</div>
|
|
82
|
+
|
|
83
|
+
<!-- Client Configuratie -->
|
|
84
|
+
<div class="client-config" style="border-top: 1px solid #999; margin-top: 10px; padding-top: 10px;">
|
|
85
|
+
<h4 style="margin-top: 0;"><i class="fa fa-sitemap"></i> Client Configuratie</h4>
|
|
86
|
+
|
|
87
|
+
<div class="form-row">
|
|
88
|
+
<label for="node-input-clientHost"><i class="fa fa-server"></i> Host</label>
|
|
89
|
+
<input type="text" id="node-input-clientHost" placeholder="localhost">
|
|
90
|
+
</div>
|
|
91
|
+
|
|
92
|
+
<div class="form-row">
|
|
93
|
+
<label for="node-input-clientPort"><i class="fa fa-plug"></i> Port</label>
|
|
94
|
+
<input type="number" id="node-input-clientPort" placeholder="8080" min="1" max="65535">
|
|
95
|
+
</div>
|
|
96
|
+
|
|
97
|
+
<div class="form-row">
|
|
98
|
+
<label for="node-input-clientIpVersion"><i class="fa fa-globe"></i> IP Versie</label>
|
|
99
|
+
<select id="node-input-clientIpVersion" style="width: 70%;">
|
|
100
|
+
<option value="4">IPv4</option>
|
|
101
|
+
<option value="6">IPv6</option>
|
|
102
|
+
</select>
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
<div class="form-row">
|
|
106
|
+
<label for="node-input-clientAutoConnect">
|
|
107
|
+
<input type="checkbox" id="node-input-clientAutoConnect" style="display: inline-block; width: auto; vertical-align: top;">
|
|
108
|
+
<span style="width: 70%; display: inline-block;">Auto Verbinden</span>
|
|
109
|
+
</label>
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
<div class="form-row">
|
|
113
|
+
<label for="node-input-clientReconnect">
|
|
114
|
+
<input type="checkbox" id="node-input-clientReconnect" style="display: inline-block; width: auto; vertical-align: top;">
|
|
115
|
+
<span style="width: 70%; display: inline-block;">Herconnectie</span>
|
|
116
|
+
</label>
|
|
117
|
+
</div>
|
|
118
|
+
|
|
119
|
+
<div class="form-row">
|
|
120
|
+
<label for="node-input-clientReconnectInterval"><i class="fa fa-clock-o"></i> Reconnect Interval (sec)</label>
|
|
121
|
+
<input type="number" id="node-input-clientReconnectInterval" placeholder="5" min="0">
|
|
122
|
+
</div>
|
|
123
|
+
|
|
124
|
+
<div class="form-row">
|
|
125
|
+
<label for="node-input-clientMaxReconnectAttempts"><i class="fa fa-repeat"></i> Max Reconnect Pogingen (0 = oneindig)</label>
|
|
126
|
+
<input type="number" id="node-input-clientMaxReconnectAttempts" placeholder="0" min="0">
|
|
127
|
+
</div>
|
|
128
|
+
|
|
129
|
+
<div class="form-row">
|
|
130
|
+
<label for="node-input-clientConnectionTimeout"><i class="fa fa-hourglass"></i> Connection Timeout (sec)</label>
|
|
131
|
+
<input type="number" id="node-input-clientConnectionTimeout" placeholder="10" min="1">
|
|
132
|
+
</div>
|
|
133
|
+
|
|
134
|
+
<div class="form-row">
|
|
135
|
+
<label for="node-input-clientInputFormat"><i class="fa fa-code"></i> Input Format</label>
|
|
136
|
+
<select id="node-input-clientInputFormat" style="width: 70%;">
|
|
137
|
+
<option value="string">String</option>
|
|
138
|
+
<option value="buffer">Buffer</option>
|
|
139
|
+
<option value="json">JSON</option>
|
|
140
|
+
<option value="hex">Hex String</option>
|
|
141
|
+
</select>
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
<div class="form-row">
|
|
145
|
+
<label for="node-input-clientOutputFormat"><i class="fa fa-code"></i> Output Format</label>
|
|
146
|
+
<select id="node-input-clientOutputFormat" style="width: 70%;">
|
|
147
|
+
<option value="string">String</option>
|
|
148
|
+
<option value="buffer">Buffer</option>
|
|
149
|
+
<option value="json">JSON</option>
|
|
150
|
+
<option value="hex">Hex String</option>
|
|
151
|
+
</select>
|
|
152
|
+
</div>
|
|
153
|
+
|
|
154
|
+
<div class="form-row">
|
|
155
|
+
<label for="node-input-clientEncoding"><i class="fa fa-font"></i> Encoding (voor String format)</label>
|
|
156
|
+
<select id="node-input-clientEncoding" style="width: 70%;">
|
|
157
|
+
<option value="utf8">UTF-8</option>
|
|
158
|
+
<option value="ascii">ASCII</option>
|
|
159
|
+
<option value="latin1">Latin1</option>
|
|
160
|
+
<option value="base64">Base64</option>
|
|
161
|
+
</select>
|
|
162
|
+
</div>
|
|
163
|
+
|
|
164
|
+
<div class="form-row">
|
|
165
|
+
<label for="node-input-clientDelimiter"><i class="fa fa-cut"></i> Message Delimiter (optioneel)</label>
|
|
166
|
+
<input type="text" id="node-input-clientDelimiter" placeholder="bijv. \\n of \\r\\n">
|
|
167
|
+
</div>
|
|
168
|
+
|
|
169
|
+
<div class="form-row">
|
|
170
|
+
<label for="node-input-clientKeepAlive">
|
|
171
|
+
<input type="checkbox" id="node-input-clientKeepAlive" style="display: inline-block; width: auto; vertical-align: top;">
|
|
172
|
+
<span style="width: 70%; display: inline-block;">Keep-Alive</span>
|
|
173
|
+
</label>
|
|
174
|
+
</div>
|
|
175
|
+
</div>
|
|
176
|
+
|
|
177
|
+
<!-- Server Configuratie -->
|
|
178
|
+
<div class="server-config" style="border-top: 1px solid #999; margin-top: 10px; padding-top: 10px;">
|
|
179
|
+
<h4 style="margin-top: 0;"><i class="fa fa-server"></i> Server Configuratie</h4>
|
|
180
|
+
|
|
181
|
+
<div class="form-row">
|
|
182
|
+
<label for="node-input-serverPort"><i class="fa fa-plug"></i> Listen Port</label>
|
|
183
|
+
<input type="number" id="node-input-serverPort" placeholder="8080" min="1" max="65535">
|
|
184
|
+
</div>
|
|
185
|
+
|
|
186
|
+
<div class="form-row">
|
|
187
|
+
<label for="node-input-serverBindAddress"><i class="fa fa-network-wired"></i> Bind Address</label>
|
|
188
|
+
<input type="text" id="node-input-serverBindAddress" placeholder="0.0.0.0">
|
|
189
|
+
</div>
|
|
190
|
+
|
|
191
|
+
<div class="form-row">
|
|
192
|
+
<label for="node-input-serverIpVersion"><i class="fa fa-globe"></i> IP Versie</label>
|
|
193
|
+
<select id="node-input-serverIpVersion" style="width: 70%;">
|
|
194
|
+
<option value="4">IPv4</option>
|
|
195
|
+
<option value="6">IPv6</option>
|
|
196
|
+
</select>
|
|
197
|
+
</div>
|
|
198
|
+
|
|
199
|
+
<div class="form-row">
|
|
200
|
+
<label for="node-input-serverAutoStart">
|
|
201
|
+
<input type="checkbox" id="node-input-serverAutoStart" style="display: inline-block; width: auto; vertical-align: top;">
|
|
202
|
+
<span style="width: 70%; display: inline-block;">Auto Start</span>
|
|
203
|
+
</label>
|
|
204
|
+
</div>
|
|
205
|
+
|
|
206
|
+
<div class="form-row">
|
|
207
|
+
<label for="node-input-serverMaxConnections"><i class="fa fa-users"></i> Max Connections (0 = onbeperkt)</label>
|
|
208
|
+
<input type="number" id="node-input-serverMaxConnections" placeholder="0" min="0">
|
|
209
|
+
</div>
|
|
210
|
+
|
|
211
|
+
<div class="form-row">
|
|
212
|
+
<label for="node-input-serverConnectionTimeout"><i class="fa fa-hourglass"></i> Connection Timeout (sec)</label>
|
|
213
|
+
<input type="number" id="node-input-serverConnectionTimeout" placeholder="600" min="1">
|
|
214
|
+
</div>
|
|
215
|
+
|
|
216
|
+
<div class="form-row">
|
|
217
|
+
<label for="node-input-serverInputFormat"><i class="fa fa-code"></i> Input Format</label>
|
|
218
|
+
<select id="node-input-serverInputFormat" style="width: 70%;">
|
|
219
|
+
<option value="string">String</option>
|
|
220
|
+
<option value="buffer">Buffer</option>
|
|
221
|
+
<option value="json">JSON</option>
|
|
222
|
+
<option value="hex">Hex String</option>
|
|
223
|
+
</select>
|
|
224
|
+
</div>
|
|
225
|
+
|
|
226
|
+
<div class="form-row">
|
|
227
|
+
<label for="node-input-serverOutputFormat"><i class="fa fa-code"></i> Output Format</label>
|
|
228
|
+
<select id="node-input-serverOutputFormat" style="width: 70%;">
|
|
229
|
+
<option value="string">String</option>
|
|
230
|
+
<option value="buffer">Buffer</option>
|
|
231
|
+
<option value="json">JSON</option>
|
|
232
|
+
<option value="hex">Hex String</option>
|
|
233
|
+
</select>
|
|
234
|
+
</div>
|
|
235
|
+
|
|
236
|
+
<div class="form-row">
|
|
237
|
+
<label for="node-input-serverEncoding"><i class="fa fa-font"></i> Encoding (voor String format)</label>
|
|
238
|
+
<select id="node-input-serverEncoding" style="width: 70%;">
|
|
239
|
+
<option value="utf8">UTF-8</option>
|
|
240
|
+
<option value="ascii">ASCII</option>
|
|
241
|
+
<option value="latin1">Latin1</option>
|
|
242
|
+
<option value="base64">Base64</option>
|
|
243
|
+
</select>
|
|
244
|
+
</div>
|
|
245
|
+
|
|
246
|
+
<div class="form-row">
|
|
247
|
+
<label for="node-input-serverDelimiter"><i class="fa fa-cut"></i> Message Delimiter (optioneel)</label>
|
|
248
|
+
<input type="text" id="node-input-serverDelimiter" placeholder="bijv. \\n of \\r\\n">
|
|
249
|
+
</div>
|
|
250
|
+
|
|
251
|
+
<div class="form-row">
|
|
252
|
+
<label for="node-input-serverKeepAlive">
|
|
253
|
+
<input type="checkbox" id="node-input-serverKeepAlive" style="display: inline-block; width: auto; vertical-align: top;">
|
|
254
|
+
<span style="width: 70%; display: inline-block;">Keep-Alive</span>
|
|
255
|
+
</label>
|
|
256
|
+
</div>
|
|
257
|
+
</div>
|
|
258
|
+
</script>
|
|
259
|
+
|
|
260
|
+
<script type="text/html" data-help-name="tcp-client-server-avd">
|
|
261
|
+
<p>TCP Client/Server node voor Node-RED.</p>
|
|
262
|
+
|
|
263
|
+
<h3>Client Mode</h3>
|
|
264
|
+
<p>Voor client mode, stel de mode in op "TCP Client" en configureer:</p>
|
|
265
|
+
<ul>
|
|
266
|
+
<li><b>Host</b>: Server hostname of IP adres</li>
|
|
267
|
+
<li><b>Port</b>: Server poort nummer</li>
|
|
268
|
+
<li><b>Auto Verbinden</b>: Automatisch verbinden bij flow start</li>
|
|
269
|
+
<li><b>Herconnectie</b>: Automatische herconnectie bij verbroken verbinding</li>
|
|
270
|
+
</ul>
|
|
271
|
+
|
|
272
|
+
<h3>Server Mode</h3>
|
|
273
|
+
<p>Voor server mode, stel de mode in op "TCP Server" en configureer:</p>
|
|
274
|
+
<ul>
|
|
275
|
+
<li><b>Listen Port</b>: Poort waarop de server luistert</li>
|
|
276
|
+
<li><b>Bind Address</b>: IP adres om aan te binden (0.0.0.0 = alle interfaces)</li>
|
|
277
|
+
<li><b>Auto Start</b>: Server automatisch starten bij flow start</li>
|
|
278
|
+
</ul>
|
|
279
|
+
|
|
280
|
+
<h3>Input Messages</h3>
|
|
281
|
+
<p><b>Client Mode:</b></p>
|
|
282
|
+
<ul>
|
|
283
|
+
<li><code>{topic: "connect"}</code> - Verbinden met server</li>
|
|
284
|
+
<li><code>{topic: "disconnect"}</code> - Verbinding verbreken</li>
|
|
285
|
+
<li><code>{topic: "send", payload: "data"}</code> - Data verzenden</li>
|
|
286
|
+
</ul>
|
|
287
|
+
|
|
288
|
+
<p><b>Server Mode:</b></p>
|
|
289
|
+
<ul>
|
|
290
|
+
<li><code>{topic: "start"}</code> - Server starten</li>
|
|
291
|
+
<li><code>{topic: "stop"}</code> - Server stoppen</li>
|
|
292
|
+
<li><code>{topic: "send", clientId: "id", payload: "data"}</code> - Data naar client verzenden</li>
|
|
293
|
+
<li><code>{topic: "broadcast", payload: "data"}</code> - Data naar alle clients verzenden</li>
|
|
294
|
+
</ul>
|
|
295
|
+
|
|
296
|
+
<h3>Output Messages</h3>
|
|
297
|
+
<p>Output messages bevatten <code>topic</code> en <code>payload</code> velden. Voor server mode worden ook <code>clientId</code> en <code>remoteAddress</code> meegestuurd.</p>
|
|
298
|
+
</script>
|