This section contains examples for the OPC-UA Monitoring Request Subscriptions
Attention The status code of a frame might return either “Good” or “Bad” if later case occurs, then also the OPC-UA Error Message will be returned! |
Request with Reporting Both Timestamps
var requestData = {
"operation": "MONITORING_SUBSCRIBE",
"nodes": ["myNode","myOtherNode"],
"namespaceIndices": [2,2],
"publishingInterval":1000.0,
"clientHandlingID": 1,
"samplingInterval": 1000.0,
"queueSize": 2,
"discardOldestItem": true,
"monitoringMode": "Reporting",
"returnedTimestamps": "Both"
}
This request subscribes the nodes “myNode” and “myOtherNode” that resides in namespace 2 to the OPC-UA server, which will report the latest 2 changes after 1 second. The returning message frame contains the application server, OPC-UA server and source timestamps. The oldest item will be dropped.
Returning Message Frames
{
“frameType”:”data”,
“subscriptionKey”:”bb827118-f1b0-2170-9937-f8c7e1620107″,
“content”:{“data”:{
“nodeName”:”myNode”,
“namespaceIndex”:2,
“value”:”448828049″,
“appServerTime”:”Wed Oct 19 19:37:42 CEST 2016″,
“OPCUAServerTime”:”Mon Jan 01 01:00:00 CET 1601″,
“OPCUASourceTime”:”Mon Jan 01 01:00:00 CET 1601″,
“statusCode”:”Good”},
“success”:true}
}
{
“frameType”:”data”,
“subscriptionKey”:”bb827118-f1b0-2170-9937-f8c7e1620107″,
“content”:{“data”:{
“nodeName”:”myOtherNode”,
“namespaceIndex”:2,
“value”:”22223423″,
“appServerTime”:”Wed Oct 19 19:37:43 CEST 2016″,
“OPCUAServerTime”:”Mon Jan 01 01:00:00 CET 1601″,
“OPCUASourceTime”:”Mon Jan 01 01:00:00 CET 1601″,
“statusCode”:”Good”},
“success”:true}
}
Request with Reporting Source Timestamp
var requestData = {
"operation": "MONITORING_SUBSCRIBE",
"nodes": ["myNode","myOtherNode"],
"namespaceIndices": [2,2],
"publishingInterval":500.0,
"clientHandlingID": 1,
"samplingInterval": 1000.0,
"queueSize": 1,
"discardOldestItem": true,
"monitoringMode": "Reporting",
"returnedTimestamps": "Source"
}
This request subscribes the nodes “myNode” and “myOtherNode” that resides in namespace 2 to the OPC-UA server, which will report the last change after 500 milliseconds. The returning message frame contains the application server and source timestamps. The oldest item will be dropped but it does not matter, as the queue can contain only one element.
Returning Message Frames
{
“frameType”:”data”,
“subscriptionKey”:”aa827118-f1b0-2170-9937-f8c7e1620107″,
“content”:{“data”:{
“nodeName”:”myNode”,
“namespaceIndex”:2,
“value”:”324234″,
“appServerTime”:”Wed Oct 19 19:37:42 CEST 2016″,
“OPCUASourceTime”:”Mon Jan 01 01:00:00 CET 1601″,
“statusCode”:”Good”},
“success”:true}
}
{
“frameType”:”data”,
“subscriptionKey”:”aa827118-f1b0-2170-9937-f8c7e1620107″,
“content”:{“data”:{
“nodeName”:”myOtherNode”,
“namespaceIndex”:2,
“value”:”2333543″,
“appServerTime”:”Wed Oct 19 19:37:43 CEST 2016″,
“OPCUASourceTime”:”Mon Jan 01 01:00:00 CET 1601″,
“statusCode”:”Good”},
“success”:true}
}
Request with Reporting Server Timestamp
var requestData = {
"operation": "MONITORING_SUBSCRIBE",
"nodes": ["myNode","myOtherNode"],
"namespaceIndices": [2,2],
"publishingInterval":2000.0,
"clientHandlingID": 1,
"samplingInterval": 1000.0,
"queueSize": 20,
"discardOldestItem": false,
"monitoringMode": "Reporting",
"returnedTimestamps": "Server"
}
This request subscribes the nodes “myNode” and “myOtherNode” that resides in namespace 2 to the OPC-UA server, which will report the last 20 changes after 2 seconds. The returning message frame contains the application server and OPC-UA server timestamps. The oldest item will not be dropped.
Returning Message Frame
{
“frameType”:”data”,
“subscriptionKey”:”cc827118-f1b0-2170-9937-f8c7e1620107″,
“content”:{“data”:{
“nodeName”:”myNode”,
“namespaceIndex”:2,
“value”:”4488280898″,
“appServerTime”:”Wed Oct 19 19:37:42 CEST 2016″,
“OPCUAServerTime”:”Mon Jan 01 01:00:00 CET 1601″,
“statusCode”:”Good”},
“success”:true}
}
{
“frameType”:”data”,
“subscriptionKey”:”cc827118-f1b0-2170-9937-f8c7e1620107″,
“content”:{“data”:{
“nodeName”:”myOtherNode”,
“namespaceIndex”:2,
“value”:”22223425″,
“appServerTime”:”Wed Oct 19 19:37:43 CEST 2016″,
“OPCUAServerTime”:”Mon Jan 01 01:00:00 CET 1601″,
“statusCode”:”Good”},
“success”:true}
}
Request with Reporting Neither Timestamps
var requestData = {
"operation": "MONITORING_SUBSCRIBE",
"nodes": ["myNode","myOtherNode"],
"namespaceIndices": [2,2],
"publishingInterval":100.0,
"clientHandlingID": 1,
"samplingInterval": 1000.0,
"queueSize": 5,
"discardOldestItem": true,
"monitoringMode": "Reporting",
"returnedTimestamps": "Neither"
}
This request subscribes the nodes “myNode” and “myOtherNode” that resides in namespace 2 to the OPC-UA server, which will report the last 5 changes after 100 millieconds. The returning message frame contains only the application server timestamp. The oldest item will be dropped.
Returning Message Frames
{
“frameType”:”data”,
“subscriptionKey”:”dd827118-f1b0-2170-9937-f8c7e1620107″,
“content”:{“data”:{
“nodeName”:”myNode”,
“namespaceIndex”:2,
“value”:”448828042″,
“appServerTime”:”Wed Oct 19 19:37:42 CEST 2016″,
“statusCode”:”Good”},
“success”:true}
}
{
“frameType”:”data”,
“subscriptionKey”:”dd827118-f1b0-2170-9937-f8c7e1620107″,
“content”:{“data”:{
“nodeName”:”myOtherNode”,
“namespaceIndex”:2,
“value”:”22223421″,
“appServerTime”:”Wed Oct 19 19:37:43 CEST 2016″,
“statusCode”:”Good”},
“success”:true}
}
Request with Sampling
var requestData = {
"operation": "MONITORING_SUBSCRIBE",
"nodes": ["myNode"],
"namespaceIndices": [2],
"publishingInterval":1000.0,
"clientHandlingID": 1,
"samplingInterval": 100.0,
"queueSize": 10,
"discardOldestItem": true,
"monitoringMode": "Sampling",
"returnedTimestamps": "Neither"
}
This request subscribes the nodes “myNode” that resides in namespace 2 to the OPC-UA server, which will sample the node every 100 milliseconds and return the last 10 changes after 1 seconds. The returning message frame contains only the application server timestamp. The oldest item will be dropped.
Returning Message Frame
{
“frameType”:”data”,
“subscriptionKey”:”ff827118-f1b0-2170-9937-f8c7e1620107″,
“content”:{“data”:{
“nodeName”:”myNode”,
“namespaceIndex”:2,
“value”:”448828043″,
“appServerTime”:”Wed Oct 19 19:37:42 CEST 2016″,
“statusCode”:”Good”},
“success”:true}
}