How to use the node-opcua-utils.WatchDog function in node-opcua-utils

To help you get started, we’ve selected a few node-opcua-utils 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_session.ts View on Github external
import { WatchDog } from "node-opcua-utils";
import { lowerFirstLetter } from "node-opcua-utils";

import { ServerSecureChannelLayer } from "node-opcua-secure-channel";
import { ApplicationDescription, UserIdentityToken, ReferenceDescriptionOptions, MessageSecurityMode } from "node-opcua-types";

import { ISubscriber, IWatchdogData2 } from "node-opcua-utils";
import { ServerSidePublishEngine } from "./server_publish_engine";
import { Subscription } from "./server_subscription";
import { SubscriptionState } from "./server_subscription";
import { any } from "async";
import { UAVariable } from "node-opcua-address-space/dist/src/ua_variable";

const debugLog = make_debugLog(__filename);
const doDebug = checkDebugFlag(__filename);
const theWatchDog = new WatchDog();

const registeredNodeNameSpace = 9999;

function compareSessionId(
  sessionDiagnostics1: SessionDiagnosticsDataType | SessionSecurityDiagnosticsDataType,
  sessionDiagnostics2: SessionDiagnosticsDataType | SessionSecurityDiagnosticsDataType
) {
    return sessionDiagnostics1.sessionId.toString() === sessionDiagnostics2.sessionId.toString();
}

function on_channel_abort(this: ServerSession) {
    debugLog("ON CHANNEL ABORT ON  SESSION!!!");
    /**
     * @event channel_aborted
     */
    this.emit("channel_aborted");
github node-opcua / node-opcua / packages / node-opcua-server / src / server_session.js View on Github external
const NodeClass = require("node-opcua-data-model").NodeClass;
const QualifiedName = require("node-opcua-data-model").QualifiedName;

const DataValue = require("node-opcua-data-value").DataValue;
const VariableIds = require("node-opcua-constants").VariableIds;

const ec = require("node-opcua-basic-types");
const assert = require("node-opcua-assert").assert;
const util = require("util");
const EventEmitter = require("events").EventEmitter;
const eoan = require("node-opcua-address-space");
const makeNodeId = require("node-opcua-nodeid").makeNodeId;
const ObjectIds = require("node-opcua-constants").ObjectIds;

const WatchDog = require("node-opcua-utils").WatchDog;
const theWatchDog = new WatchDog();

const ContinuationPointManager = require("./continuation_point_manager").ContinuationPointManager;

const utils = require("node-opcua-utils");
const debugLog = require("node-opcua-debug").make_debugLog(__filename);
const doDebug = require("node-opcua-debug").checkDebugFlag(__filename);

/**
 *
 * A Server session object.
 *
 * **from OPCUA Spec 1.02:**
 *
 * * Sessions are created to be independent of the underlying communications connection. Therefore, if a communication
 *   connection fails, the Session is not immediately affected. The exact mechanism to recover from an underlying
 *   communication connection error depends on the SecureChannel mapping as described in Part 6.