How to use the node-opcua-secure-channel.ServerSecureChannelLayer function in node-opcua-secure-channel

To help you get started, we’ve selected a few node-opcua-secure-channel 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-server / source / server_end_point.ts View on Github external
const establish_connection = () => {

            const nbConnections = Object.keys(this._channels).length;
            debugLog(" nbConnections ", nbConnections, " self._server.maxConnections",
              this._server!.maxConnections, this.maxConnections);
            if (nbConnections >= this.maxConnections) {
                debugLog(chalk.bgWhite.cyan("OPCUAServerEndPoint#_on_client_connection " +
                  "The maximum number of connection has been reached - Connection is refused"));
                socket.end();
                (socket as any).destroy();
                return;
            }

            debugLog("OPCUAServerEndPoint._on_client_connection successful => New Channel");

            const channel = new ServerSecureChannelLayer({
                defaultSecureTokenLifetime: this.defaultSecureTokenLifetime,
                // objectFactory: this.objectFactory,
                parent: this,
                timeout: this.timeout
            });

            socket.resume();

            this._preregisterChannel(channel);

            channel.init(socket, (err?: Error) => {
                this._un_pre_registerChannel(channel);
                debugLog(chalk.yellow.bold("Channel#init done"), err);
                if (err) {
                    socket.end();
                } else {
github node-opcua / node-opcua / packages / node-opcua-server / source / server_end_point.ts View on Github external
const establish_connection = () => {

            const nbConnections = Object.keys(this._channels).length;
            debugLog(" nbConnections ", nbConnections, " self._server.maxConnections",
              this._server!.maxConnections, this.maxConnections);
            if (nbConnections >= this.maxConnections) {
                debugLog(chalk.bgWhite.cyan("OPCUAServerEndPoint#_on_client_connection " +
                  "The maximum number of connection has been reached - Connection is refused"));
                socket.end();
                (socket as any).destroy();
                return;
            }

            debugLog("OPCUAServerEndPoint._on_client_connection successful => New Channel");

            const channel = new ServerSecureChannelLayer({
                defaultSecureTokenLifetime: this.defaultSecureTokenLifetime,
                // objectFactory: this.objectFactory,
                parent: this,
                timeout: this.timeout
            });

            socket.resume();

            this._preregisterChannel(channel);

            channel.init(socket, (err?: Error) => {
                this._un_pre_registerChannel(channel);
                debugLog(chalk.yellow.bold("Channel#init done"), err);
                if (err) {
                    socket.end();
                } else {