How to use the node-opcua-transport.ClientTCP_transport function in node-opcua-transport

To help you get started, we’ve selected a few node-opcua-transport examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github node-opcua / node-opcua / packages / node-opcua-secure-channel / source / client / client_secure_channel_layer.ts View on Github external
}
                    /* istanbul ignore next */
                    if (!publicKey) {
                        throw new Error("Internal Error");
                    }
                    this.receiverPublicKey = publicKey;

                    this.create(endpointUrl, callback);
                });
                return;
            }
        }

        this.endpointUrl = endpointUrl;

        const transport = new ClientTCP_transport();
        transport.timeout = this.transportTimeout;

        this._establish_connection(
            transport,
            endpointUrl,
            (err?: Error) => {

                if (err) {
                    debugLog(chalk.red("cannot connect to server"));
                    transport.dispose();
                    return callback(err);
                }

                this._on_connection(transport, callback);

            }
github node-opcua / node-opcua / packages / node-opcua-secure-channel / src / client / client_secure_channel_layer.js View on Github external
/* istanbul ignore next */
                if (err) {
                    return callback(err);
                }
                self.receiverPublicKey = publicKey;
                assert(!_.isUndefined(self.receiverPublicKey)); // make sure we wont go into infinite recursion calling create again.
                self.create(endpointUrl, callback);
            });
            return;
        }
        assert(typeof self.receiverPublicKey === "string");
    }


    self.endpointUrl = endpointUrl;
    const transport = new ClientTCP_transport();
    transport.timeout = self.transportTimeout;
    transport.protocolVersion = self.protocolVersion;


    // -------------------------------------------------------------------------
    // Handle reconnection
    // --------------------------------------------------------------------------
    const _establish_connection = function (transport, endpointUrl, callback) {


        let last_err = null;

        function _connect(_i_callback) {

            if (self.__call && self.__call._cancelBackoff) {
                return;