mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
More node i18n tidy-up
This commit is contained in:
@@ -13,63 +13,6 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<script type="text/javascript">
|
||||
function ws_oneditprepare() {
|
||||
$("#websocket-client-row").hide();
|
||||
$("#node-input-mode").change(function(){
|
||||
if( $("#node-input-mode").val() === 'client') {
|
||||
$("#websocket-server-row").hide();
|
||||
$("#websocket-client-row").show();
|
||||
}
|
||||
else {
|
||||
$("#websocket-server-row").show();
|
||||
$("#websocket-client-row").hide();
|
||||
}
|
||||
});
|
||||
|
||||
if(this.client) {
|
||||
$("#node-input-mode").val('client').change();
|
||||
}
|
||||
else {
|
||||
$("#node-input-mode").val('server').change();
|
||||
}
|
||||
}
|
||||
|
||||
function ws_oneditsave() {
|
||||
if($("#node-input-mode").val() === 'client') {
|
||||
$("#node-input-server").append('<option value="">Dummy</option>');
|
||||
$("#node-input-server").val('');
|
||||
}
|
||||
else {
|
||||
$("#node-input-client").append('<option value="">Dummy</option>');
|
||||
$("#node-input-client").val('');
|
||||
}
|
||||
}
|
||||
|
||||
function ws_label() {
|
||||
var nodeid = (this.client)?this.client:this.server;
|
||||
var wsNode = RED.nodes.node(nodeid);
|
||||
return this.name||(wsNode?"[ws] "+wsNode.label():"websocket");
|
||||
}
|
||||
|
||||
function ws_validateserver() {
|
||||
if($("#node-input-mode").val() === 'client' || (this.client && !this.server)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return RED.nodes.node(this.server) != null;
|
||||
}
|
||||
}
|
||||
|
||||
function ws_validateclient() {
|
||||
if($("#node-input-mode").val() === 'client' || (this.client && !this.server)) {
|
||||
return RED.nodes.node(this.client) != null;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<!-- WebSocket Input Node -->
|
||||
<script type="text/x-red" data-template-name="websocket in">
|
||||
<div class="form-row">
|
||||
@@ -101,6 +44,65 @@ function ws_validateclient() {
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
(function() {
|
||||
|
||||
function ws_oneditprepare() {
|
||||
$("#websocket-client-row").hide();
|
||||
$("#node-input-mode").change(function(){
|
||||
if( $("#node-input-mode").val() === 'client') {
|
||||
$("#websocket-server-row").hide();
|
||||
$("#websocket-client-row").show();
|
||||
}
|
||||
else {
|
||||
$("#websocket-server-row").show();
|
||||
$("#websocket-client-row").hide();
|
||||
}
|
||||
});
|
||||
|
||||
if(this.client) {
|
||||
$("#node-input-mode").val('client').change();
|
||||
}
|
||||
else {
|
||||
$("#node-input-mode").val('server').change();
|
||||
}
|
||||
}
|
||||
|
||||
function ws_oneditsave() {
|
||||
if($("#node-input-mode").val() === 'client') {
|
||||
$("#node-input-server").append('<option value="">Dummy</option>');
|
||||
$("#node-input-server").val('');
|
||||
}
|
||||
else {
|
||||
$("#node-input-client").append('<option value="">Dummy</option>');
|
||||
$("#node-input-client").val('');
|
||||
}
|
||||
}
|
||||
|
||||
function ws_label() {
|
||||
var nodeid = (this.client)?this.client:this.server;
|
||||
var wsNode = RED.nodes.node(nodeid);
|
||||
return this.name||(wsNode?"[ws] "+wsNode.label():"websocket");
|
||||
}
|
||||
|
||||
function ws_validateserver() {
|
||||
if($("#node-input-mode").val() === 'client' || (this.client && !this.server)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return RED.nodes.node(this.server) != null;
|
||||
}
|
||||
}
|
||||
|
||||
function ws_validateclient() {
|
||||
if($("#node-input-mode").val() === 'client' || (this.client && !this.server)) {
|
||||
return RED.nodes.node(this.client) != null;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
RED.nodes.registerType('websocket in',{
|
||||
category: 'input',
|
||||
defaults: {
|
||||
@@ -119,6 +121,75 @@ function ws_validateclient() {
|
||||
oneditsave: ws_oneditsave,
|
||||
oneditprepare: ws_oneditprepare
|
||||
});
|
||||
|
||||
RED.nodes.registerType('websocket out',{
|
||||
category: 'output',
|
||||
defaults: {
|
||||
name: {value:""},
|
||||
server: {type:"websocket-listener", validate: ws_validateserver},
|
||||
client: {type:"websocket-client", validate: ws_validateclient}
|
||||
},
|
||||
color:"rgb(215, 215, 160)",
|
||||
inputs:1,
|
||||
outputs:0,
|
||||
icon: "white-globe.png",
|
||||
align: "right",
|
||||
labelStyle: function() {
|
||||
return this.name?"node_label_italic":"";
|
||||
},
|
||||
label: ws_label,
|
||||
oneditsave: ws_oneditsave,
|
||||
oneditprepare: ws_oneditprepare
|
||||
});
|
||||
|
||||
RED.nodes.registerType('websocket-listener',{
|
||||
category: 'config',
|
||||
defaults: {
|
||||
path: {value:"",required:true,validate:RED.validators.regex(/^((?!\/debug\/ws).)*$/) },
|
||||
wholemsg: {value:"false"}
|
||||
},
|
||||
inputs:0,
|
||||
outputs:0,
|
||||
label: function() {
|
||||
var root = RED.settings.httpNodeRoot;
|
||||
if (root.slice(-1) != "/") {
|
||||
root = root+"/";
|
||||
}
|
||||
if (this.path.charAt(0) == "/") {
|
||||
root += this.path.slice(1);
|
||||
} else {
|
||||
root += this.path;
|
||||
}
|
||||
return root;
|
||||
},
|
||||
oneditprepare: function() {
|
||||
var root = RED.settings.httpNodeRoot;
|
||||
if (root.slice(-1) == "/") {
|
||||
root = root.slice(0,-1);
|
||||
}
|
||||
if (root == "") {
|
||||
$("#node-config-ws-tip").hide();
|
||||
} else {
|
||||
$("#node-config-ws-path").html(root);
|
||||
$("#node-config-ws-tip").show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
RED.nodes.registerType('websocket-client',{
|
||||
category: 'config',
|
||||
defaults: {
|
||||
path: {value:"",required:true,validate:RED.validators.regex(/^((?!\/debug\/ws).)*$/) },
|
||||
wholemsg: {value:"false"}
|
||||
},
|
||||
inputs:0,
|
||||
outputs:0,
|
||||
label: function() {
|
||||
return this.path;
|
||||
}
|
||||
});
|
||||
|
||||
})();
|
||||
</script>
|
||||
|
||||
<!-- WebSocket out Node -->
|
||||
@@ -157,28 +228,6 @@ function ws_validateclient() {
|
||||
should delete the <b>msg._session</b> property within the flow</p>.
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType('websocket out',{
|
||||
category: 'output',
|
||||
defaults: {
|
||||
name: {value:""},
|
||||
server: {type:"websocket-listener", validate: ws_validateserver},
|
||||
client: {type:"websocket-client", validate: ws_validateclient}
|
||||
},
|
||||
color:"rgb(215, 215, 160)",
|
||||
inputs:1,
|
||||
outputs:0,
|
||||
icon: "white-globe.png",
|
||||
align: "right",
|
||||
labelStyle: function() {
|
||||
return this.name?"node_label_italic":"";
|
||||
},
|
||||
label: ws_label,
|
||||
oneditsave: ws_oneditsave,
|
||||
oneditprepare: ws_oneditprepare
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- WebSocket Server configuration node -->
|
||||
<script type="text/x-red" data-template-name="websocket-listener">
|
||||
<div class="form-row">
|
||||
@@ -202,42 +251,6 @@ function ws_validateclient() {
|
||||
<p>This configuration node creates a WebSocket Server using the specified path</p>
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType('websocket-listener',{
|
||||
category: 'config',
|
||||
defaults: {
|
||||
path: {value:"",required:true,validate:RED.validators.regex(/^((?!\/debug\/ws).)*$/) },
|
||||
wholemsg: {value:"false"}
|
||||
},
|
||||
inputs:0,
|
||||
outputs:0,
|
||||
label: function() {
|
||||
var root = RED.settings.httpNodeRoot;
|
||||
if (root.slice(-1) != "/") {
|
||||
root = root+"/";
|
||||
}
|
||||
if (this.path.charAt(0) == "/") {
|
||||
root += this.path.slice(1);
|
||||
} else {
|
||||
root += this.path;
|
||||
}
|
||||
return root;
|
||||
},
|
||||
oneditprepare: function() {
|
||||
var root = RED.settings.httpNodeRoot;
|
||||
if (root.slice(-1) == "/") {
|
||||
root = root.slice(0,-1);
|
||||
}
|
||||
if (root == "") {
|
||||
$("#node-config-ws-tip").hide();
|
||||
} else {
|
||||
$("#node-config-ws-path").html(root);
|
||||
$("#node-config-ws-tip").show();
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- WebSocket Client configuration node -->
|
||||
<script type="text/x-red" data-template-name="websocket-client">
|
||||
<div class="form-row">
|
||||
@@ -261,17 +274,3 @@ function ws_validateclient() {
|
||||
<p>This configuration node connects a WebSocket client to the specified URL.</p>
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType('websocket-client',{
|
||||
category: 'config',
|
||||
defaults: {
|
||||
path: {value:"",required:true,validate:RED.validators.regex(/^((?!\/debug\/ws).)*$/) },
|
||||
wholemsg: {value:"false"}
|
||||
},
|
||||
inputs:0,
|
||||
outputs:0,
|
||||
label: function() {
|
||||
return this.path;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
@@ -17,7 +17,7 @@
|
||||
<script type="text/x-red" data-template-name="watch">
|
||||
<div class="form-row node-input-filename">
|
||||
<label for="node-input-files"><i class="fa fa-file"></i> <span data-i18n="watch.label.files"></span></label>
|
||||
<input type="text" id="node-input-files" data-i18n="[placeholder]watch.label.filesph">
|
||||
<input type="text" id="node-input-files" data-i18n="[placeholder]watch.placeholder.files">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
|
||||
|
@@ -18,8 +18,8 @@
|
||||
<div class="form-row">
|
||||
<label for="node-input-server"><i class="fa fa-dot-circle-o"></i> <span data-i18n="tcpin.label.type"></span></label>
|
||||
<select id="node-input-server" style="width:120px; margin-right:5px;">
|
||||
<option value="server" data-i18n="tcpin.listen"></option>
|
||||
<option value="client" data-i18n="tcpin.connect"></option>
|
||||
<option value="server" data-i18n="tcpin.type.listen"></option>
|
||||
<option value="client" data-i18n="tcpin.type.connect"></option>
|
||||
</select>
|
||||
<span data-i18n="tcpin.label.port"></span> <input type="text" id="node-input-port" style="width: 50px">
|
||||
</div>
|
||||
@@ -29,15 +29,14 @@
|
||||
|
||||
<div class="form-row">
|
||||
<label><i class="fa fa-sign-out"></i> <span data-i18n="tcpin.label.output"></span></label>
|
||||
<span data-i18n="tcpin.label.a"></span>
|
||||
<select id="node-input-datamode" style="width:110px;">
|
||||
<option value="stream" data-i18n="tcpin.stream"></option>
|
||||
<option value="single" data-i18n="tcpin.single"></option>
|
||||
<option value="stream" data-i18n="tcpin.output.stream"></option>
|
||||
<option value="single" data-i18n="tcpin.output.single"></option>
|
||||
</select>
|
||||
<select id="node-input-datatype" style="width:140px;">
|
||||
<option value="buffer" data-i18n="tcpin.buffer"></option>
|
||||
<option value="utf8" data-i18n="tcpin.string"></option>
|
||||
<option value="base64" data-i18n="tcpin.base64"></option>
|
||||
<option value="buffer" data-i18n="tcpin.output.buffer"></option>
|
||||
<option value="utf8" data-i18n="tcpin.output.string"></option>
|
||||
<option value="base64" data-i18n="tcpin.output.base64"></option>
|
||||
</select>
|
||||
<span data-i18n="tcpin.label.payload"></span>
|
||||
</div>
|
||||
@@ -118,15 +117,15 @@
|
||||
<div class="form-row">
|
||||
<label for="node-input-beserver"><i class="fa fa-dot-circle-o"></i> <span data-i18n="tcpin.label.type"></span></label>
|
||||
<select id="node-input-beserver" style="width:150px; margin-right:5px;">
|
||||
<option value="server" data-i18n="tcpin.listen"></option>
|
||||
<option value="client" data-i18n="tcpin.connect"></option>
|
||||
<option value="reply" data-i18n="tcpin.reply"></option>
|
||||
<option value="server" data-i18n="tcpin.type.listen"></option>
|
||||
<option value="client" data-i18n="tcpin.type.connect"></option>
|
||||
<option value="reply" data-i18n="tcpin.type.reply"></option>
|
||||
</select>
|
||||
<span id="node-input-port-row"><span data-i18n="tcpin.label.port"></span> <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;">
|
||||
<span data-i18n="tcpin.label.host"></span> <input type="text" id="node-input-host" placeholder="localhost" style="width: 60%;">
|
||||
<span data-i18n="tcpin.label.host"></span> <input type="text" id="node-input-host" style="width: 60%;">
|
||||
</div>
|
||||
|
||||
<div class="form-row hidden" id="node-input-end-row">
|
||||
@@ -145,13 +144,6 @@
|
||||
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
|
||||
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
|
||||
</div>
|
||||
|
||||
<div class="form-tips hidden" id="fin-tip">
|
||||
<span data-i18n="[html]tcpin.out-tip1"></span>
|
||||
</div>
|
||||
<div class="form-tips hidden" id="fin-tip2">
|
||||
<span data-i18n="[html]tcpin.out-tip2"></span>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/x-red" data-help-name="tcp out">
|
||||
@@ -199,17 +191,8 @@
|
||||
|
||||
if (sockettype == "client") {
|
||||
$("#node-input-host-row").show();
|
||||
$("#fin-tip").show();
|
||||
} else {
|
||||
$("#node-input-host-row").hide();
|
||||
$("#fin-tip").hide();
|
||||
}
|
||||
|
||||
if (sockettype == "server") {
|
||||
$("#fin-tip2").show();
|
||||
}
|
||||
else {
|
||||
$("#fin-tip2").hide();
|
||||
}
|
||||
};
|
||||
updateOptions();
|
||||
@@ -223,15 +206,15 @@
|
||||
<div class="form-row">
|
||||
<label for="node-input-server"><i class="fa fa-globe"></i> <span data-i18n="tcpin.label.server"></span></label>
|
||||
<input type="text" id="node-input-server" placeholder="ip.address" style="width:45%">
|
||||
port <input type="text" id="node-input-port" data-i18n="[placeholder]tcpin.label.numberph" style="width:60px">
|
||||
port <input type="text" id="node-input-port" style="width:60px">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-out"><i class="fa fa-sign-out"></i> <span data-i18n="tcpin.label.return"></span></label>
|
||||
<select type="text" id="node-input-out" style="width:56%;">
|
||||
<option value="time" data-i18n="tcpin.timeout"></option>
|
||||
<option value="char" data-i18n="tcpin.character"></option>
|
||||
<option value="count" data-i18n="tcpin.number"></option>
|
||||
<option value="sit" data-i18n="tcpin.never"></option>
|
||||
<option value="time" data-i18n="tcpin.return.timeout"></option>
|
||||
<option value="char" data-i18n="tcpin.return.character"></option>
|
||||
<option value="count" data-i18n="tcpin.return.number"></option>
|
||||
<option value="sit" data-i18n="tcpin.return.never"></option>
|
||||
</select>
|
||||
<input type="text" id="node-input-splitc" style="width:50px;">
|
||||
<span id="node-units"></span>
|
||||
@@ -240,7 +223,6 @@
|
||||
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
|
||||
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
|
||||
</div>
|
||||
<div class="form-tips"><span data-i18n="[html]tcpin.req-tip"></span></div>
|
||||
<script>
|
||||
var previous = null;
|
||||
$("#node-input-out").on('focus', function () { previous = this.value; }).change(function() {
|
||||
|
@@ -43,13 +43,13 @@ module.exports = function(RED) {
|
||||
var reconnectTimeout;
|
||||
var end = false;
|
||||
var setupTcpClient = function() {
|
||||
node.log(RED._("tcpin.errors.connecting-to")+" "+node.host+":"+node.port);
|
||||
node.log(RED._("tcpin.status.connecting",{host:node.host,port:node.port}));
|
||||
node.status({fill:"grey",shape:"dot",text:RED._("common.status.connecting")});
|
||||
var id = (1+Math.random()*4294967295).toString(16);
|
||||
client = net.connect(node.port, node.host, function() {
|
||||
buffer = (node.datatype == 'buffer')? new Buffer(0):"";
|
||||
node.connected = true;
|
||||
node.log(RED._("tcpin.errors.connected-to")+" "+node.host+":"+node.port);
|
||||
node.log(RED._("tcpin.status.connected",{host:node.host,port:node.port}));
|
||||
node.status({fill:"green",shape:"dot",text:RED._("common.status.connected")});
|
||||
});
|
||||
connectionPool[id] = client;
|
||||
@@ -103,7 +103,7 @@ module.exports = function(RED) {
|
||||
reconnectTimeout = setTimeout(setupTcpClient, 20);
|
||||
}
|
||||
else {
|
||||
node.log(RED._("tcpin.errors.connection-lost")+" "+node.host+":"+node.port);
|
||||
node.log(RED._("tcpin.errors.connection-lost",{host:node.host,port:node.port}));
|
||||
reconnectTimeout = setTimeout(setupTcpClient, reconnectTime);
|
||||
}
|
||||
} else {
|
||||
@@ -170,7 +170,7 @@ module.exports = function(RED) {
|
||||
}
|
||||
});
|
||||
socket.on('timeout', function() {
|
||||
node.log(RED._("tcpin.errors.timeout")+' '+node.port);
|
||||
node.log(RED._("tcpin.errors.timeout",{port:node.port}));
|
||||
socket.end();
|
||||
});
|
||||
socket.on('close', function() {
|
||||
@@ -183,15 +183,15 @@ module.exports = function(RED) {
|
||||
});
|
||||
server.on('error', function(err) {
|
||||
if (err) {
|
||||
node.error(RED._("tcpin.errors.cannot-listen")+' '+node.port+' : '+err);
|
||||
node.error(RED._("tcpin.errors.cannot-listen",{port:node.port,error:err}));
|
||||
}
|
||||
});
|
||||
|
||||
server.listen(node.port, function(err) {
|
||||
if (err) {
|
||||
node.error(RED._("tcpin.errors.cannot-listen")+' '+node.port+' : '+err);
|
||||
node.error(RED._("tcpin.errors.cannot-listen",{port:node.port,error:err}));
|
||||
} else {
|
||||
node.log(RED._("tcpin.errors.listening-port")+' '+node.port);
|
||||
node.log(RED._("tcpin.status.listening-port",{port:node.port}));
|
||||
node.on('close', function() {
|
||||
for (var c in connectionPool) {
|
||||
if (connectionPool.hasOwnProperty(c)) {
|
||||
@@ -201,7 +201,7 @@ module.exports = function(RED) {
|
||||
}
|
||||
node.closing = true;
|
||||
server.close();
|
||||
node.log(RED._("tcpin.errors.stopped-listening")+' '+node.port);
|
||||
node.log(RED._("tcpin.status.stopped-listening",{port:node.port}));
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -228,15 +228,15 @@ module.exports = function(RED) {
|
||||
var end = false;
|
||||
|
||||
var setupTcpClient = function() {
|
||||
node.log(RED._("tcpin.errors.connecting-to")+" "+node.host+":"+node.port);
|
||||
node.log(RED._("tcpin.status.connecting",{host:node.host,port:node.port}));
|
||||
node.status({fill:"grey",shape:"dot",text:RED._("common.status.connecting")});
|
||||
client = net.connect(node.port, node.host, function() {
|
||||
node.connected = true;
|
||||
node.log(RED._("tcpin.errors.connected-to")+" "+node.host+":"+node.port);
|
||||
node.log(RED._("tcpin.status.connected",{host:node.host,port:node.port}));
|
||||
node.status({fill:"green",shape:"dot",text:RED._("common.status.connected")});
|
||||
});
|
||||
client.on('error', function (err) {
|
||||
node.log(RED._("tcpin.errors.error")+' : '+err);
|
||||
node.log(RED._("tcpin.errors.error",{error:err}));
|
||||
});
|
||||
client.on('end', function (err) {
|
||||
});
|
||||
@@ -250,7 +250,7 @@ module.exports = function(RED) {
|
||||
reconnectTimeout = setTimeout(setupTcpClient,20);
|
||||
}
|
||||
else {
|
||||
node.log(RED._("tcpin.errors.connection-lost")+" "+node.host+":"+node.port);
|
||||
node.log(RED._("tcpin.errors.connection-lost",{host:node.host,port:node.port}));
|
||||
reconnectTimeout = setTimeout(setupTcpClient,reconnectTime);
|
||||
}
|
||||
} else {
|
||||
@@ -305,20 +305,20 @@ module.exports = function(RED) {
|
||||
var server = net.createServer(function (socket) {
|
||||
if (socketTimeout !== null) { socket.setTimeout(socketTimeout); }
|
||||
var remoteDetails = socket.remoteAddress+":"+socket.remotePort;
|
||||
node.log(RED._("tcpin.errors.connection-from")+" "+remoteDetails);
|
||||
node.log(RED._("tcpin.status.connection-from",{host:socket.remoteAddress, port:socket.remotePort}));
|
||||
connectedSockets.push(socket);
|
||||
node.status({text:connectedSockets.length+" "+RED._("common.status.connections")});
|
||||
socket.on('timeout', function() {
|
||||
node.log(RED._("tcpin.errors.timeout")+' '+node.port);
|
||||
node.log(RED._("tcpin.errors.timeout",{port:node.port}));
|
||||
socket.end();
|
||||
});
|
||||
socket.on('close',function() {
|
||||
node.log(RED._("tcpin.errors.connection-closed")+" "+remoteDetails);
|
||||
node.log(RED._("tcpin.status.connection-closed",{host:socket.remoteAddress, port:socket.remotePort}));
|
||||
connectedSockets.splice(connectedSockets.indexOf(socket),1);
|
||||
node.status({text:connectedSockets.length+" "+RED._("common.status.connections")});
|
||||
});
|
||||
socket.on('error',function() {
|
||||
node.log(RED._("tcpin.errors.socket-error")+" "+remoteDetails);
|
||||
node.log(RED._("tcpin.errors.socket-error",{host:socket.remoteAddress, port:socket.remotePort}));
|
||||
connectedSockets.splice(connectedSockets.indexOf(socket),1);
|
||||
node.status({text:connectedSockets.length+" "+RED._("common.status.connections")});
|
||||
});
|
||||
@@ -343,15 +343,15 @@ module.exports = function(RED) {
|
||||
|
||||
server.on('error', function(err) {
|
||||
if (err) {
|
||||
node.error(RED._("tcpin.errors.cannot-listen")+' '+node.port+' : '+err);
|
||||
node.error(RED._("tcpin.errors.cannot-listen",{port:node.port,error:err}));
|
||||
}
|
||||
});
|
||||
|
||||
server.listen(node.port, function(err) {
|
||||
if (err) {
|
||||
node.error(RED._("tcpin.errors.cannot-listen")+' '+node.port+' : '+err);
|
||||
node.error(RED._("tcpin.errors.cannot-listen",{port:node.port,error:err}));
|
||||
} else {
|
||||
node.log(RED._("tcpin.errors.listening-port")+' '+node.port);
|
||||
node.log(RED._("tcpin.status.listening-port",{port:node.port}));
|
||||
node.on('close', function() {
|
||||
for (var c in connectedSockets) {
|
||||
if (connectedSockets.hasOwnProperty(c)) {
|
||||
@@ -360,7 +360,7 @@ module.exports = function(RED) {
|
||||
}
|
||||
}
|
||||
server.close();
|
||||
node.log(RED._("tcpin.errors.stopped-listening")+' '+node.port);
|
||||
node.log(RED._("tcpin.status.stopped-listening",{port:node.port}));
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -482,7 +482,7 @@ module.exports = function(RED) {
|
||||
});
|
||||
|
||||
client.on('timeout',function() {
|
||||
node.warn(RED._("tcpin.errors.timeout"));
|
||||
node.warn(RED._("tcpin.errors.connect-timeout"));
|
||||
if (client) {
|
||||
client.end();
|
||||
setTimeout(function() {
|
||||
|
Reference in New Issue
Block a user