How to use the node-opcua-service-subscription.PublishResponse 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 / src / server_publish_engine.js View on Github external
invalid_published_request.forEach(function (publishData) {
        console.log(" CANCELING TIMEOUT PUBLISH REQUEST ".cyan);
        const response = new subscription_service.PublishResponse({
            responseHeader: {serviceResult: StatusCodes.BadTimeout}
        });
        self.send_response_for_request(publishData, response);
    });
};
github node-opcua / node-opcua / packages / node-opcua-server / src / server_publish_engine.js View on Github external
assert(param.hasOwnProperty("subscriptionId"));
    assert(param.hasOwnProperty("sequenceNumber"));
    assert(param.hasOwnProperty("notificationData"));
    assert(param.hasOwnProperty("moreNotifications"));

    const subscription = self.getSubscriptionById(param.subscriptionId);


    const subscriptionId = param.subscriptionId;
    const sequenceNumber = param.sequenceNumber;
    const notificationData = param.notificationData;
    const moreNotifications = param.moreNotifications;

    const availableSequenceNumbers = subscription ? subscription.getAvailableSequenceNumbers() : [];

    const response = new subscription_service.PublishResponse({
        subscriptionId: subscriptionId,
        availableSequenceNumbers: availableSequenceNumbers,
        moreNotifications: moreNotifications,
        notificationMessage: {
            sequenceNumber: sequenceNumber,
            publishTime: new Date(),
            notificationData: notificationData
        }
    });

    if (self.pendingPublishRequestCount === 0) {
        console.log(" ---------------------------------------------------- PUSHING PUBLISH RESPONSE FOR LATE ANWSER !".bgRed.white.bold);
        self._publish_response_queue.push(response);
    } else {
        const publishData = self._publish_request_queue.shift();
        self.send_response_for_request(publishData, response);
github node-opcua / node-opcua / packages / node-opcua-server / src / server_publish_engine.js View on Github external
ServerSidePublishEngine.prototype.send_error_for_request = function (publishData, statusCode) {
    const self = this;
    _assertValidPublishData(publishData);
    self.send_response_for_request(publishData, new subscription_service.PublishResponse({
        responseHeader: {serviceResult: statusCode}
    }));
};