How to use the node-opcua-service-subscription.CreateSubscriptionRequest function in node-opcua-service-subscription

To help you get started, we’ve selected a few node-opcua-service-subscription 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 / test_to_fix / test_subscriptions.js View on Github external
it("server should create a subscription (CreateSubscriptionRequest)", function (done) {

        // CreateSubscriptionRequest
        var request = new subscription_service.CreateSubscriptionRequest({
            requestedPublishingInterval: 100,
            requestedLifetimeCount: 100 * 60 * 10,
            requestedMaxKeepAliveCount: 2,
            maxNotificationsPerPublish: 2,
            publishingEnabled: true,
            priority: 6
        });
        g_session.createSubscription(request, function (err, response) {
            if (!err) {
                response.should.be.instanceof(subscription_service.CreateSubscriptionResponse);
                subscriptionId = response.subscriptionId;
            }
            done(err);

        });
    });
github node-opcua / node-opcua / packages / node-opcua-client / src / client_subscription.js View on Github external
ClientSubscription.prototype.__create_subscription = function (callback) {

    assert(_.isFunction(callback));

    const self = this;

    const session = self.publish_engine.session;

    debugLog("ClientSubscription created ".yellow.bold);

    const request = new subscription_service.CreateSubscriptionRequest({
        requestedPublishingInterval: self.publishingInterval,
        requestedLifetimeCount: self.lifetimeCount,
        requestedMaxKeepAliveCount: self.maxKeepAliveCount,
        maxNotificationsPerPublish: self.maxNotificationsPerPublish,
        publishingEnabled: self.publishingEnabled,
        priority: self.priority
    });

    session.createSubscription(request, function (err, response) {

        if (err) {
            /* istanbul ignore next */
            self.emit("internal_error", err);
            if (callback) {
                return callback(err);
            }
github node-opcua / node-opcua / packages / node-opcua-client / src / client_session.js View on Github external
ClientSession.prototype.createSubscription = function (options, callback) {

    const self = this;
    assert(_.isFunction(callback));

    const request = new subscription_service.CreateSubscriptionRequest(options);

    self.performMessageTransaction(request, function (err, response) {

        /* istanbul ignore next */
        if (err) {
            return callback(err, response);
        }
        assert(response instanceof subscription_service.CreateSubscriptionResponse);
        callback(null, response);
    });
};