How to use the node-opcua-client.MessageSecurityMode.None function in node-opcua-client

To help you get started, we’ve selected a few node-opcua-client 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 / playground / sample1.ts View on Github external
MessageSecurityMode,
    OPCUAClient,
    OPCUAClientOptions,
    SecurityPolicy,
    UserTokenType,
    Variant
} from "node-opcua-client";

const connectionStrategy: ConnectionStrategyOptions = {
    initialDelay: 1000,
    maxRetry: 1
};
const options: OPCUAClientOptions = {
    applicationName: "Hello",
    connectionStrategy,
    securityMode: MessageSecurityMode.None,
    // securityPolicy: SecurityPolicy.Basic256Sha256
    securityPolicy: SecurityPolicy.None
};

const client = OPCUAClient.create(options);

(async () => {
    try {

        console.log(" about to connect");
        await client.connect("opc.tcp://opcuademo.sterfive.com:26543");
        console.log("connected");

        client.on("backoff", () => {
            console.log("Backoff");
        });
github node-opcua / node-opcua / packages / playground / client_with_monitored_item_group_ts.ts View on Github external
try {

        const connectionStrategy: ConnectionStrategyOptions = {
            initialDelay: 1000,
            maxDelay: 20000, // retry every 20 seconds
            maxRetry: 2 // maxRetry: 0xFFFFF // we need a large number here
        };

        const options: OPCUAClientOptions = {
            applicationName: "ClientBrowseNextDemo",
            connectionStrategy,
            endpoint_must_exist: false,
            keepSessionAlive: false,
            requestedSessionTimeout: 60000, // 1 minute
            securityMode: MessageSecurityMode.None,
            securityPolicy: SecurityPolicy.None
        };

        const client = OPCUAClient.create(options);

        client.on("backoff", (retry: number, delay: number) => {
            console.log("Backoff ", retry, " next attempt in ", delay, "ms");
        });

        client.on("connection_lost", () => {
            console.log("Connection lost");
        });

        client.on("connection_reestablished", () => {
            console.log("Connection re-established");
        });
github node-opcua / node-opcua / packages / playground / polling_client.ts View on Github external
async function main() {

    const connectionStrategy: ConnectionStrategyOptions = {
        initialDelay: 1000,
        maxDelay: 20000, // retry every 20 seconds
        maxRetry: 2, // maxRetry: 0xFFFFF // we need a large number here
    };

    const options: OPCUAClientOptions = {
        applicationName: "ClientBrowseNextDemo",
        connectionStrategy,
        endpoint_must_exist: false,
        keepSessionAlive: false,
        requestedSessionTimeout: 60000, // 1 minute
        securityMode: MessageSecurityMode.None,
        securityPolicy: SecurityPolicy.None,
    };

    const client = OPCUAClient.create(options);

    client.on("backoff", (retry: number, delay: number) => {
        console.log("Backoff ", retry, " next attempt in ", delay, "ms");
    });

    client.on("connection_lost", () => {
        console.log("Connection lost");
    });

    client.on("connection_reestablished", () => {
        console.log("Connection re-established");
    });
github node-opcua / node-opcua / packages / playground / client_with_custom_datatype.ts View on Github external
async function main() {

    const connectionStrategy: ConnectionStrategyOptions = {
        initialDelay: 1000,
        maxRetry: 1
    };
    const options: OPCUAClientOptions = {
        applicationName: "ClientWithCustomDataTypeSupport",
        connectionStrategy,
        securityMode: MessageSecurityMode.None,
        // securityPolicy: SecurityPolicy.Basic256Sha256
        securityPolicy: SecurityPolicy.None
    };

    const client = OPCUAClient.create(options);

    console.log(" about to connect");
    await client.connect("opc.tcp://" + os.hostname() + ":48010");
    console.log("connected");

    client.on("backoff", () => {
        console.log("Backoff");
    });

    const session = await client.createSession();
github node-opcua / node-opcua / packages / playground / client_browse_next_example.ts View on Github external
async function main() {

    const connectionStrategy: ConnectionStrategyOptions = {
        initialDelay: 1000,
        maxRetry: 1
    };
    const options: OPCUAClientOptions = {
        applicationName: "ClientBrowseNextDemo",
        connectionStrategy,
        securityMode: MessageSecurityMode.None,
        securityPolicy: SecurityPolicy.None
    };

    const client = OPCUAClient.create(options);

    await client.connect(endpointUri);

    client.on("backoff", () => {
        console.log("Backoff");
    });

    const session = await client.createSession();

    const result = await session.call({
        inputArguments: [
            new Variant({
github node-opcua / node-opcua / packages / playground / sample2Subscriptions.ts View on Github external
} from "node-opcua-client";

async function timeout(ms: number) {
    return new Promise((resolve) => setTimeout(resolve, ms));
}

const connectionStrategy: ConnectionStrategyOptions = {
    initialDelay: 1000,
    maxRetry: 1
};
const options: OPCUAClientOptions = {
    applicationName: "HelloSample2",
    connectionStrategy,
    defaultSecureTokenLifetime: 10000,
    keepPendingSessionsOnDisconnect: false,
    securityMode: MessageSecurityMode.None,
    securityPolicy: SecurityPolicy.None
};

const client = OPCUAClient.create(options);

client.on("backoff", (count: number, delay: number) => {
    console.log("backoff ");
});

async function test1() {

    try {

        await client.connect("opc.tcp://opcuademo.sterfive.com:26543");

        const session: ClientSession = await client.createSession({