🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

node-red-contrib-tcp-client

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-red-contrib-tcp-client - npm Package Compare versions

Comparing version

to
0.1.3

2

package.json
{
"name": "node-red-contrib-tcp-client",
"version": "0.1.2",
"version": "0.1.3",
"description": "Dynamic TCP Client",

@@ -5,0 +5,0 @@ "node-red": {

@@ -9,9 +9,9 @@ # node-red-contrib-tcp-client

Unlike the default node-red tcp-in node, this one allows you to create dynamic TCP connections.
Unlike the default node-red tcp-in node, this one allows you to create dynamic TCP connections passed as arguments.
Allows stopping an existing connection by passing a "close" action:
Allows stopping the connection by passing a "close" argument:
![node configuration](https://raw.githubusercontent.com/tiagordc/node-red-contrib-tcp-client/master/flow.png)
This was developed specifically for XML over TCP with some parsing options but other formats should still be supported.
This project was developed specifically for XML over TCP with some parsing options but other formats should still be supported.

@@ -18,0 +18,0 @@ ## How it works:

@@ -20,2 +20,3 @@ 'use strict';

this.topic = config.topic;
this.debug = config.debug;
this.stream = (!config.datamode || config.datamode=='stream'); /* stream,single*/

@@ -58,2 +59,4 @@ this.datatype = config.datatype || 'buffer'; /* buffer,utf8,base64,xml */

if (node.debug === 'all') node.warn(`Data received from ${socket.remoteAddress}:${socket.remotePort}`);
if (node.datatype != 'buffer') {

@@ -167,2 +170,4 @@ data = data.toString(node.datatype == 'xml' ? 'utf8' : node.datatype);

if (node.debug === 'all') node.warn(`Closing port ${node.port}`);
if (connectionPool[id]) {

@@ -181,2 +186,6 @@ var socket = connectionPool[id].socket;

if (node.debug === 'all') node.warn(`Closing connection to ${node.host}:${node.port}`);
//TODO
}

@@ -196,2 +205,4 @@

if (node.debug === 'all') node.warn(`Connection started with ${socket.remoteAddress}:${socket.remotePort}`);
connectionPool[id] = {

@@ -207,5 +218,3 @@ socket: socket,

server.on('error', function (err) {
if (err) {
node.error(err);
}
if (err && node.debug !== 'none') node.error(err);
});

@@ -215,4 +224,6 @@

if (node.debug === 'all') node.warn(`Starting to listen on port ${node.port}`);
server.listen(node.port, function (err) {
if (err) node.error(err);
if (err && node.debug !== 'none') node.error(err);
});

@@ -232,3 +243,3 @@

else {
node.error(`Configuration error`);
if (node.debug !== 'none') node.error(`Configuration error`);
}

@@ -238,3 +249,3 @@

else {
node.error(`Already connected`);
if (node.debug !== 'none') node.error(`Already connected`);
}

@@ -241,0 +252,0 @@

Sorry, the diff of this file is not supported yet