From 73ee657d7444df14e1d0d2a973af733a9bfa3093 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Thu, 25 Jan 2018 20:26:35 +0000 Subject: [PATCH] Add TLS options to WebSocket client --- nodes/core/io/10-mqtt.js | 1 - nodes/core/io/22-websocket.html | 21 +++++++++++++++++++-- nodes/core/io/22-websocket.js | 10 +++++++++- nodes/core/locales/en-US/messages.json | 5 +++-- 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/nodes/core/io/10-mqtt.js b/nodes/core/io/10-mqtt.js index 507ddaf04..c1a8318a6 100644 --- a/nodes/core/io/10-mqtt.js +++ b/nodes/core/io/10-mqtt.js @@ -184,7 +184,6 @@ module.exports = function(RED) { this.connect = function () { if (!node.connected && !node.connecting) { node.connecting = true; - console.log("going for connect"); try { node.client = mqtt.connect(node.brokerurl ,node.options); node.client.setMaxListeners(0); diff --git a/nodes/core/io/22-websocket.html b/nodes/core/io/22-websocket.html index 703aa7bf6..99eeea2e4 100644 --- a/nodes/core/io/22-websocket.html +++ b/nodes/core/io/22-websocket.html @@ -180,12 +180,24 @@ category: 'config', defaults: { path: {value:"",required:true,validate:RED.validators.regex(/^((?!\/debug\/ws).)*$/)}, + tls: {type:"tls-config",required: false}, wholemsg: {value:"false"} }, inputs:0, outputs:0, label: function() { return this.path; + }, + oneditprepare: function() { + $("#node-config-input-path").on("change keyup paste",function() { + $(".node-config-row-tls").toggle(/^wss:/i.test($(this).val())) + }); + $("#node-config-input-path").change(); + }, + oneditsave: function() { + if (!/^wss:/i.test($("#node-config-input-path").val())) { + $("#node-config-input-tls").val("_ADD_"); + } } }); @@ -235,7 +247,7 @@
- +
+
+ + +
+
- +