mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Add session awareness to TCP nodes
Closes #63,#65
This commit is contained in:
@@ -118,11 +118,12 @@
|
||||
<script type="text/x-red" data-template-name="tcp out">
|
||||
<div class="form-row">
|
||||
<label for="node-input-beserver"><i class="icon-resize-small"></i> Type</label>
|
||||
<select id="node-input-beserver" style="width:120px; margin-right:5px;">
|
||||
<select id="node-input-beserver" style="width:150px; margin-right:5px;">
|
||||
<option value="server">Listen on</option>
|
||||
<option value="client">Connect to</option>
|
||||
<option value="reply">Reply to TCP</option>
|
||||
</select>
|
||||
port <input type="text" id="node-input-port" style="width: 50px">
|
||||
<span id="node-input-port-row">port <input type="text" id="node-input-port" style="width: 50px"></span>
|
||||
</div>
|
||||
|
||||
<div class="form-row hidden" id="node-input-host-row" style="padding-left: 110px;">
|
||||
@@ -143,7 +144,7 @@
|
||||
|
||||
<script type="text/x-red" data-help-name="tcp out">
|
||||
<p>Provides a choice of tcp outputs. Can either connect to a remote tcp port,
|
||||
or accept incoming connections.</p>
|
||||
accept incoming connections, or reply to messages received from a TCP In node.</p>
|
||||
<p>Only <b>msg.payload</b> is sent.</p>
|
||||
<p>If <b>msg.payload</b> is a string containing a base64 encoding of binary
|
||||
data, the Base64 decoding option will cause it to be converted back to binary
|
||||
@@ -155,8 +156,8 @@
|
||||
category: 'output',
|
||||
color:"Silver",
|
||||
defaults: {
|
||||
host: {value:"",validate:function(v) { return (this.beserver == "server")||v.length > 0;} },
|
||||
port: {value:"",required:true},
|
||||
host: {value:"",validate:function(v) { return (this.beserver != "client")||v.length > 0;} },
|
||||
port: {value:"",validate:function(v) { return (this.beserver == "reply")||RED.validators.number()(v) } },
|
||||
beserver: {value:"client",required:true},
|
||||
base64: {value:false,required:true},
|
||||
name: {value:""}
|
||||
@@ -174,6 +175,13 @@
|
||||
oneditprepare: function() {
|
||||
var updateOptions = function() {
|
||||
var sockettype = $("#node-input-beserver option:selected").val();
|
||||
if (sockettype == "reply") {
|
||||
$("#node-input-port-row").hide();
|
||||
$("#node-input-host-row").hide();
|
||||
} else {
|
||||
$("#node-input-port-row").show();
|
||||
}
|
||||
|
||||
if (sockettype == "client") {
|
||||
$("#node-input-host-row").show();
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user