如何使用node-opcua订阅优先级?

How to use node-opcua Subscription priority?

node-opcua 中的客户端订阅有一个名为 priority 的选项。它是一个数值字段。我无法理解 Priotity=1 订阅的优先级是否高于 Priority=10 或更低。

源代码中的默认优先级是1。那么它是最低的,还是最高的? 1 或 10 或 100 哪一个会得到优先考虑?

这是规范中的引述(v1.03 第 4 部分。Table 86)

Indicates the relative priority of the Subscription. When more than one Subscription needs to send Notifications, the Server should dequeue a Publish request to the Subscription with the highest priority number (the bigger the number, the higher the priority). For Subscriptions with equal priority the Server should dequeue Publish requests in a round-robin fashion. When the keep-alive period expires for a Subscription it shall take precedence regardless of its priority, in order to prevent the Subscription from expiring.

A Client that does not require special priority settings should set this value to zero.

我不太了解服务器在实践中如何实际支持优先级。它应该只有在服务器同时有大量数据变化需要排队时才起作用。对于大多数情况,您可以忽略该参数。

编辑:规范可从 https://opcfoundation.org/developer-tools/specifications-unified-architecture 获得(您只需注册到 OPC 基金会网站即可下载)

编辑:1.04 的规范现在也可以在线获得,描述优先级参数的特定页面是 https://reference.opcfoundation.org/v104/Core/docs/Part4/5.13.2/