Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-opcua-transport

Package Overview
Dependencies
Maintainers
1
Versions
221
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-opcua-transport - npm Package Compare versions

Comparing version 2.1.8 to 2.2.0

dist/tsconfig.tsbuildinfo

0

dist/source/AcknowledgeMessage.d.ts

@@ -0,0 +0,0 @@ /**

2

dist/source/AcknowledgeMessage.js

@@ -60,2 +60,3 @@ "use strict";

}
exports.AcknowledgeMessage = AcknowledgeMessage;
AcknowledgeMessage.possibleFields = [

@@ -69,3 +70,2 @@ "protocolVersion",

AcknowledgeMessage.schema = schemaAcknowledgeMessage;
exports.AcknowledgeMessage = AcknowledgeMessage;
//# sourceMappingURL=AcknowledgeMessage.js.map

@@ -16,3 +16,3 @@ import { TCP_transport } from "./tcp_transport";

*
* transport.timeout = 1000;
* transport.timeout = 10000;
*

@@ -19,0 +19,0 @@ * transport.connect(function(err)) {

@@ -32,8 +32,4 @@ "use strict";

socket = net_1.createConnection({ host: hostname, port });
// Setting true for noDelay will immediately fire off data each time socket.write() is called.
socket.setNoDelay(true);
socket.setTimeout(0);
socket.on("timeout", () => {
debugLog("Socket has timed out");
});
// // Setting true for noDelay will immediately fire off data each time socket.write() is called.
// socket.setNoDelay(true);
return socket;

@@ -65,3 +61,3 @@ case "fake:":

*
* transport.timeout = 1000;
* transport.timeout = 10000;
*

@@ -101,2 +97,3 @@ * transport.connect(function(err)) {

dispose() {
/* istanbul ignore next */
if (doDebug) {

@@ -113,4 +110,5 @@ debugLog(" ClientTCP_transport disposed");

this.serverUri = "urn:" + gHostname + ":Sample";
/* istanbul ignore next */
if (doDebug) {
debugLog("endpointUrl =", endpointUrl, "ep", ep);
debugLog("endpointUrl =", endpointUrl);
}

@@ -121,2 +119,3 @@ try {

catch (err) {
/* istanbul ignore next */
if (doDebug) {

@@ -129,2 +128,3 @@ debugLog("CreateClientSocket has failed");

const _on_socket_error_after_connection = (err) => {
/* istanbul ignore next */
if (doDebug) {

@@ -148,2 +148,3 @@ debugLog(" _on_socket_error_after_connection ClientTCP_transport Socket Error", err.message);

const _on_socket_connect = () => {
/* istanbul ignore next */
if (doDebug) {

@@ -155,2 +156,3 @@ debugLog("entering _on_socket_connect");

if (!err) {
/* istanbul ignore next */
if (!this._socket) {

@@ -178,2 +180,3 @@ throw new Error("internal error");

// this handler will catch attempt to connect to an inaccessible address.
/* istanbul ignore next */
if (doDebug) {

@@ -187,2 +190,3 @@ debugLog(" _on_socket_error_for_connect", err.message);

const _on_socket_end_for_connect = (err) => {
/* istanbul ignore next */
if (doDebug) {

@@ -193,2 +197,3 @@ debugLog("_on_socket_end_for_connect Socket has been closed by server", err);

const _remove_connect_listeners = () => {
/* istanbul ignore next */
if (!this._socket) {

@@ -216,2 +221,3 @@ return;

let err;
/* istanbul ignore next */
if (messageHeader.isFinal !== "F") {

@@ -240,2 +246,3 @@ err = new Error(" invalid ACK message");

_send_HELLO_request() {
/* istanbul ignore next */
if (doDebug) {

@@ -261,2 +268,3 @@ debugLog("entering _send_HELLO_request");

_on_ACK_response(externalCallback, err, data) {
/* istanbul ignore next */
if (doDebug) {

@@ -283,2 +291,3 @@ debugLog("entering _on_ACK_response");

_perform_HEL_ACK_transaction(callback) {
/* istanbul ignore next */
if (!this._socket) {

@@ -290,2 +299,3 @@ return callback(new Error("No socket available to perform HEL/ACK transaction"));

this._counter = 0;
/* istanbul ignore next */
if (doDebug) {

@@ -295,2 +305,3 @@ debugLog("entering _perform_HEL_ACK_transaction");

this._install_one_time_message_receiver((err, data) => {
/* istanbul ignore next */
if (doDebug) {

@@ -297,0 +308,0 @@ debugLog("before _on_ACK_response");

@@ -0,0 +0,0 @@ /**

@@ -75,2 +75,3 @@ "use strict";

}
exports.HelloMessage = HelloMessage;
HelloMessage.possibleFields = [

@@ -84,3 +85,2 @@ "protocolVersion",

];
exports.HelloMessage = HelloMessage;
//# sourceMappingURL=HelloMessage.js.map

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ /// <reference types="node" />

@@ -14,3 +14,3 @@ "use strict";

const node_opcua_utils_1 = require("node-opcua-utils");
const doPerfMonitoring = false;
const doPerfMonitoring = process.env.NODEOPCUADEBUG && (process.env.NODEOPCUADEBUG.indexOf("PERF")) >= 0;
const errorLog = node_opcua_debug_1.make_errorLog("MessageBuilder");

@@ -17,0 +17,0 @@ function readRawMessageHeader(data) {

@@ -0,0 +0,0 @@ /// <reference types="node" />

@@ -0,0 +0,0 @@ "use strict";

@@ -9,3 +9,3 @@ /// <reference types="node" />

export declare class TCP_transport extends EventEmitter {
timeout: number;
private static registry;
/**

@@ -35,3 +35,5 @@ * indicates the version number of the OPCUA protocol used

private packetAssembler?;
private _timeout;
constructor();
timeout: number;
dispose(): void;

@@ -38,0 +40,0 @@ /**

@@ -12,2 +12,3 @@ "use strict";

const debug = require("node-opcua-debug");
const node_opcua_object_registry_1 = require("node-opcua-object-registry");
const node_opcua_packet_assembler_1 = require("node-opcua-packet-assembler");

@@ -38,3 +39,3 @@ const message_builder_base_1 = require("./message_builder_base");

this._timerId = null;
this.timeout = 30000; // 30 seconds timeout
this._timeout = 30000; // 30 seconds timeout
this._socket = null;

@@ -52,4 +53,13 @@ this.headerSize = 8;

this._onSocketEndedHasBeenCalled = false;
TCP_transport.registry.register(this);
}
get timeout() {
return this._timeout;
}
set timeout(value) {
debugLog("Setting socket " + this.name + " timeout = ", value);
this._timeout = value;
}
dispose() {
this._cleanup_timers();
node_opcua_assert_1.assert(!this._timerId);

@@ -61,2 +71,3 @@ if (this._socket) {

}
TCP_transport.registry.unregister(this);
}

@@ -130,4 +141,4 @@ /**

}
this.on_socket_ended(null);
setImmediate(() => {
this.on_socket_ended(null);
callback();

@@ -172,2 +183,3 @@ });

});
/* istanbul ignore next */
if (!this.packetAssembler) {

@@ -182,16 +194,15 @@ throw new Error("Internal Error");

.on("error", (err) => this._on_socket_error(err));
const doDestroyOnTimeout = false;
if (doDestroyOnTimeout) {
// set socket timeout
debugLog("setting _socket.setTimeout to ", this.timeout);
this._socket.setTimeout(this.timeout, () => {
debugLog(` _socket ${this.name} has timed out (timeout = ${this.timeout})`);
if (this._socket) {
this._socket.destroy();
// 08/2008 shall we do this ?
this._socket.removeAllListeners();
this._socket = null;
}
});
}
this._socket.once("close", () => this.dispose());
// set socket timeout
debugLog("setting " + this.name + " _socket.setTimeout to ", this.timeout);
this._socket.setTimeout(this.timeout, () => {
debugLog(` _socket ${this.name} has timed out (timeout = ${this.timeout})`);
if (this._socket) {
// we consider this as an error
this._socket.emit("error", new Error("INTERNAL_EPIPE timeout=" + this.timeout));
this._socket.destroy(); // new Error("Socket has timed out"));
this._socket.removeAllListeners();
this._socket = null;
}
});
}

@@ -320,3 +331,3 @@ /**

if (doDebug) {
debugLog(chalk_1.default.red(" SOCKET END : "), err ? chalk_1.default.yellow(err.message) : "null", this.name);
debugLog(chalk_1.default.red(" SOCKET END : err="), chalk_1.default.yellow(err ? err.message : "null"), this.name);
}

@@ -334,2 +345,3 @@ this._on_socket_ended_message(err);

exports.TCP_transport = TCP_transport;
TCP_transport.registry = new node_opcua_object_registry_1.ObjectRegistry();
//# sourceMappingURL=tcp_transport.js.map

@@ -44,4 +44,4 @@ "use strict";

}
exports.TCPErrorMessage = TCPErrorMessage;
TCPErrorMessage.possibleFields = ["statusCode", "reason"];
exports.TCPErrorMessage = TCPErrorMessage;
//# sourceMappingURL=TCPErrorMessage.js.map

@@ -0,0 +0,0 @@ /// <reference types="node" />

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ /// <reference types="node" />

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ /// <reference types="node" />

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ /// <reference types="node" />

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export * from "./fake_server";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { FakeServer } from "./fake_server";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ /// <reference types="node" />

export * from "./fixture_full_tcp_packets";

@@ -0,0 +0,0 @@ "use strict";

{
"name": "node-opcua-transport",
"version": "2.1.8",
"description": "pure nodejs OPCUA SDK - module -transport",
"main": "./dist/source/index.js",
"types": "./dist/source/index.d.ts",
"scripts": {
"build": "tsc",
"test": "mocha test",
"clean": "node -e \"require('rimraf').sync('dist');\""
},
"dependencies": {
"chalk": "^2.4.2",
"node-opcua-assert": "^2.0.0",
"node-opcua-basic-types": "^2.1.6",
"node-opcua-binary-stream": "^2.1.0",
"node-opcua-buffer-utils": "^2.1.0",
"node-opcua-chunkmanager": "^2.1.6",
"node-opcua-debug": "^2.1.0",
"node-opcua-factory": "^2.1.6",
"node-opcua-nodeid": "^2.1.6",
"node-opcua-packet-assembler": "^2.0.0",
"node-opcua-status-code": "^2.1.6",
"node-opcua-types": "^2.1.8",
"node-opcua-utils": "^2.1.6",
"underscore": "^1.9.1"
},
"devDependencies": {
"@types/node": "^12.7.4",
"@types/underscore": "^1.9.2",
"colors": "^1.3.3",
"node-opcua-debug": "^2.1.0",
"node-opcua-generator": "^2.1.8",
"should": "13.2.3",
"sinon": "^7.4.2"
},
"author": "Etienne Rossignon",
"license": "MIT",
"repository": {
"type": "git",
"url": "git://github.com/node-opcua/node-opcua.git"
},
"keywords": [
"OPCUA",
"opcua",
"m2m",
"iot",
"opc ua",
"internet of things"
],
"homepage": "http://node-opcua.github.io/",
"gitHead": "a9290b68d48927403e853e438ea9bd1bc6ad3f78"
"name": "node-opcua-transport",
"version": "2.2.0",
"description": "pure nodejs OPCUA SDK - module -transport",
"main": "./dist/source/index.js",
"types": "./dist/source/index.d.ts",
"scripts": {
"build": "tsc",
"test": "mocha test",
"clean": "node -e \"require('rimraf').sync('dist');\""
},
"dependencies": {
"chalk": "^2.4.2",
"node-opcua-assert": "^2.0.0",
"node-opcua-basic-types": "^2.2.0",
"node-opcua-binary-stream": "^2.2.0",
"node-opcua-buffer-utils": "^2.2.0",
"node-opcua-chunkmanager": "^2.2.0",
"node-opcua-debug": "^2.2.0",
"node-opcua-factory": "^2.2.0",
"node-opcua-nodeid": "^2.2.0",
"node-opcua-object-registry": "^2.2.0",
"node-opcua-packet-assembler": "^2.0.0",
"node-opcua-status-code": "^2.2.0",
"node-opcua-types": "^2.2.0",
"node-opcua-utils": "^2.2.0",
"underscore": "^1.9.1"
},
"devDependencies": {
"@types/node": "^12.11.2",
"@types/underscore": "^1.9.3",
"colors": "^1.4.0",
"node-opcua-debug": "^2.1.0",
"node-opcua-generator": "^2.2.0",
"should": "13.2.3",
"sinon": "^7.5.0"
},
"author": "Etienne Rossignon",
"license": "MIT",
"repository": {
"type": "git",
"url": "git://github.com/node-opcua/node-opcua.git"
},
"keywords": [
"OPCUA",
"opcua",
"m2m",
"iot",
"opc ua",
"internet of things"
],
"homepage": "http://node-opcua.github.io/",
"gitHead": "e77e0371580d04e874b2023f8a5751c3608bc3f9"
}

@@ -0,0 +0,0 @@ /**

@@ -29,3 +29,3 @@ /**

const ep = parseEndpointUrl(endpointUrl);
const port = parseInt( ep.port!, 10);
const port = parseInt(ep.port!, 10);
const hostname = ep.hostname!;

@@ -38,11 +38,5 @@ let socket: Socket;

// Setting true for noDelay will immediately fire off data each time socket.write() is called.
socket.setNoDelay(true);
// // Setting true for noDelay will immediately fire off data each time socket.write() is called.
// socket.setNoDelay(true);
socket.setTimeout(0);
socket.on("timeout", () => {
debugLog("Socket has timed out");
});
return socket;

@@ -77,3 +71,3 @@ case "fake:":

*
* transport.timeout = 1000;
* transport.timeout = 10000;
*

@@ -122,2 +116,3 @@ * transport.connect(function(err)) {

public dispose() {
/* istanbul ignore next */
if (doDebug) {

@@ -139,4 +134,5 @@ debugLog(" ClientTCP_transport disposed");

this.serverUri = "urn:" + gHostname + ":Sample";
/* istanbul ignore next */
if (doDebug) {
debugLog("endpointUrl =", endpointUrl, "ep", ep);
debugLog("endpointUrl =", endpointUrl);
}

@@ -146,2 +142,3 @@ try {

} catch (err) {
/* istanbul ignore next */
if (doDebug) {

@@ -156,2 +153,3 @@ debugLog("CreateClientSocket has failed");

const _on_socket_error_after_connection = (err: Error) => {
/* istanbul ignore next */
if (doDebug) {

@@ -178,2 +176,3 @@ debugLog(" _on_socket_error_after_connection ClientTCP_transport Socket Error", err.message);

/* istanbul ignore next */
if (doDebug) {

@@ -185,2 +184,3 @@ debugLog("entering _on_socket_connect");

if (!err) {
/* istanbul ignore next */
if (!this._socket) {

@@ -209,2 +209,3 @@ throw new Error("internal error");

// this handler will catch attempt to connect to an inaccessible address.
/* istanbul ignore next */
if (doDebug) {

@@ -218,3 +219,4 @@ debugLog(" _on_socket_error_for_connect", err.message);

const _on_socket_end_for_connect = (err: Error | null) => {
const _on_socket_end_for_connect = (err: Error | null) => {
/* istanbul ignore next */
if (doDebug) {

@@ -225,3 +227,4 @@ debugLog("_on_socket_end_for_connect Socket has been closed by server", err);

const _remove_connect_listeners = () => {
const _remove_connect_listeners = () => {
/* istanbul ignore next */
if (!this._socket) {

@@ -254,2 +257,3 @@ return;

let err;
/* istanbul ignore next */
if (messageHeader.isFinal !== "F") {

@@ -284,2 +288,3 @@ err = new Error(" invalid ACK message");

/* istanbul ignore next */
if (doDebug) {

@@ -312,2 +317,3 @@ debugLog("entering _send_HELLO_request");

/* istanbul ignore next */
if (doDebug) {

@@ -336,2 +342,3 @@ debugLog("entering _on_ACK_response");

private _perform_HEL_ACK_transaction(callback: ErrorCallback) {
/* istanbul ignore next */
if (!this._socket) {

@@ -343,2 +350,3 @@ return callback(new Error("No socket available to perform HEL/ACK transaction"));

this._counter = 0;
/* istanbul ignore next */
if (doDebug) {

@@ -348,2 +356,3 @@ debugLog("entering _perform_HEL_ACK_transaction");

this._install_one_time_message_receiver((err: Error | null, data?: Buffer) => {
/* istanbul ignore next */
if (doDebug) {

@@ -350,0 +359,0 @@ debugLog("before _on_ACK_response");

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /**

@@ -14,3 +14,3 @@ /**

const doPerfMonitoring = false;
const doPerfMonitoring = process.env.NODEOPCUADEBUG && (process.env.NODEOPCUADEBUG.indexOf("PERF")) >= 0;

@@ -197,3 +197,3 @@ const errorLog = make_errorLog("MessageBuilder");

return this._report_error(
`Invalid messageChunk size: the provided chunk is ${chunk.length} bytes long but header specifies ${this.messageHeader.length}`);
`Invalid messageChunk size: the provided chunk is ${chunk.length} bytes long but header specifies ${this.messageHeader.length}`);
}

@@ -200,0 +200,0 @@

@@ -0,0 +0,0 @@ /**

@@ -12,2 +12,3 @@ /**

import * as debug from "node-opcua-debug";
import { ObjectRegistry } from "node-opcua-object-registry";
import { PacketAssembler } from "node-opcua-packet-assembler";

@@ -43,3 +44,4 @@

public timeout: number;
private static registry = new ObjectRegistry();
/**

@@ -72,2 +74,3 @@ * indicates the version number of the OPCUA protocol used

private packetAssembler?: PacketAssembler;
private _timeout: number;

@@ -82,3 +85,3 @@ constructor() {

this._timerId = null;
this.timeout = 30000; // 30 seconds timeout
this._timeout = 30000; // 30 seconds timeout
this._socket = null;

@@ -100,5 +103,16 @@ this.headerSize = 8;

this._onSocketEndedHasBeenCalled = false;
TCP_transport.registry.register(this);
}
public get timeout(): number {
return this._timeout;
}
public set timeout(value: number) {
debugLog("Setting socket " + this.name + " timeout = ", value);
this._timeout = value;
}
public dispose() {
this._cleanup_timers();
assert(!this._timerId);

@@ -110,2 +124,3 @@ if (this._socket) {

}
TCP_transport.registry.unregister(this);
}

@@ -193,4 +208,4 @@

}
this.on_socket_ended(null);
setImmediate(() => {
this.on_socket_ended(null);
callback();

@@ -244,2 +259,3 @@ });

/* istanbul ignore next */
if (!this.packetAssembler) {

@@ -256,16 +272,16 @@ throw new Error("Internal Error");

const doDestroyOnTimeout = false;
if (doDestroyOnTimeout) {
// set socket timeout
debugLog("setting _socket.setTimeout to ", this.timeout);
this._socket.setTimeout(this.timeout, () => {
debugLog(` _socket ${this.name} has timed out (timeout = ${this.timeout})`);
if (this._socket) {
this._socket.destroy();
// 08/2008 shall we do this ?
this._socket.removeAllListeners();
this._socket = null;
}
});
}
this._socket.once("close", () => this.dispose());
// set socket timeout
debugLog("setting " + this.name + " _socket.setTimeout to ", this.timeout);
this._socket.setTimeout(this.timeout, () => {
debugLog(` _socket ${this.name} has timed out (timeout = ${this.timeout})`);
if (this._socket) {
// we consider this as an error
this._socket.emit("error", new Error("INTERNAL_EPIPE timeout=" + this.timeout));
this._socket.destroy(); // new Error("Socket has timed out"));
this._socket.removeAllListeners();
this._socket = null;
}
});
}

@@ -422,3 +438,3 @@

if (doDebug) {
debugLog(chalk.red(" SOCKET END : "), err ? chalk.yellow(err.message) : "null", this.name);
debugLog(chalk.red(" SOCKET END : err="), chalk.yellow(err ? err.message : "null"), this.name);
}

@@ -425,0 +441,0 @@ this._on_socket_ended_message(err);

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ import { EventEmitter } from "events";

@@ -0,0 +0,0 @@ import { EventEmitter } from "events";

@@ -0,0 +0,0 @@ // tslint:disable:no-empty

@@ -0,0 +0,0 @@ export * from "./fake_server";

@@ -0,0 +0,0 @@ // tslint:disable:no-empty

@@ -0,0 +0,0 @@ {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc