SignalR API

The SignalR API utilizes the Microsoft SignalR library. SignalR is a library for developers that simplifies the process of adding real-time web functionality to applications. Real-time web functionality is the ability to have server code push content to connected clients instantly as it becomes available, rather than having the server wait for a client to request new data.

In the OPC UA API the SignalR API is primarily used for subscribing to data and event values. This means that the API calls back to the client (e.g browser), when values have changed.

The SignalR API exposes a set of RPC-methods. The client must then implement corresponding callback methods to receive results fromt the API.

Hub

The address of the SignalR hub is /OpcUaHub.

The methods below can be reached through this hub.

Methods

MethodCallback
ReadValues(string requestId, ReadValuesRequest[] request)OnReadValues(string requestId, ReadValuesResponse[] response)
WriteValues(string requestId, WriteValuesRequest[] request)OnWriteValues(string requestId, WriteValuesResponse[] response)
ReadDataTypes(string requestId, ReadDataTypesRequest request)OnReadDataTypes(string requestId, ReadDataTypesResponse response)
ReadAttributes(string requestId, ReadAttributesRequest[] request)OnReadAttributes(string requestId, ReadAttributesResponse[] response
WriteAttributes(string requestId, WriteAttributesRequest[] request)OnWriteAttributes(string requestId, WriteAttributesResponse[] response)
HistoryReadRaw(string requestId, ReadHistoryRawValuesRequest request)OnHistoryReadRaw(string requestId, ReadHistoryRawValuesResponse response)
HistoryReadProcessed(string requestId, ReadHistoryProcessedValuesRequest request)OnHistoryReadProcessed(string requestId, ReadHistoryProcessedValuesResponse response)
GetHistoricalAggregates(string requestId, HistoryAggregateRequest request)OnGetHistoricalAggregates(string requestId, HistoryAggregateResponse response)
HistoryWriteValues(string requestId, HistoryWriteRequest request)OnHistoryWriteValues(string requestId, HistoryWriteResponse response)
ReadEventsHistory(string requestId, ReadEventHistoryRequest request)OnReadEventsHistory(string requestId, ReadEventHistoryResponse response)
ReadEventsHistoryExtended(string requestId, ReadEventHistoryExtendedRequest request)OnReadEventsHistoryExtended(string requestId, ReadEventHistoryExtendedResponse response)
WriteEventsHistory(string requestId, WriteEventHistoryRequest request)OnWriteEventsHistory(string requestId, WriteEventHistoryResponse response)
WriteEventsHistoryExtended(string requestId, WriteEventHistoryExtendedRequest request)OnWriteEventsHistoryExtended(string requestId, WriteEventHistoryExtendedResponse response)
GetEventFields(string requestId)OnEventFieldsFetched(string requestId, EventFieldDefinition[] fields)
GetEventTypes(string requestId, GetEventTypesRequest request)OnGetEventTypes(string requestId, GetEventTypesResponse fields)
AddEventComments(string requestId, AddCommentRequest[] request )OnEventsCommented(string requestId, AddCommentResponse[] response)
ConfirmEvents(string requestId, ConfirmRequest[] request)On#stringEventsConfirmed(string requestId, ConfirmResponse[] response)
AcknowledgeEvents(string requestId, AcknowledgeRequest[] request)OnEventsAcknowledged(string requestId, AcknowledgeResponse[] response)
CreateEventSubscription(string requestId, CreateEventSubscriptionRequest request)OnEventSubscriptionCreated(string requestId, CreateEventSubscriptionResponse response)
OnEvents(EventsChangedResponse response)
CloseEventSubscription(string requestId, CloseEventSubscriptionRequest request)OnEventSubscriptionClosed(string requestId, CloseEventSubscriptionResponse response)
CreateDataValueSubscription(string requestId, CreateDataValueSubscriptionRequest request, bool startSubscription)OnDataValueSubscriptionCreated(string requestId, CreateDataValueSubscriptionResponse response)
OnDataValuesUpdate(DataValuesChangedResponse response)
CloseDataValueSubscription(string requestId, CloseDataValueSubscriptionRequest request)OnDataValueSubscriptionClosed(string requestId, CloseDataValueSubscriptionResponse response)
StartDataValueSubscription(string requestId, string subscriptionid)[OnDataValueSubscriptionStarted](string requestId, #ondatavaluesubscriptionstarted)(StartDataValueSubscriptionResponse response)
GetNamespaces(string requestId, NamespacesRequest request)OnNamespacesFetched(string requestId, NamespaceResponse response)
Browse(string requestId, BrowseRequest request)OnBrowse(string requestId, BrowseResponse resonse)
BrowseMulti(string requestId, BrowseMultiRequest request)OnBrowseMulti(string requestId, MultiBrowseResponse resonse)
BrowseChildren(string requestId, ChildrenRequest request)OnBrowseChildren(string requestId, BrowseResponse resonse)
BrowseProperties(string requestId, BrowsePropertiesRequest request)OnBrowseProperties(string requestId, BrowseResponse resonse)
BrowsePropertiesMulti(string requestId, BrowsePropertiesMultiRequest request)OnBrowsePropertiesMulti(string requestId, MultiBrowseResponse resonse)
TranslateBrowsePathsToNodeIds(string requestId, TranslateBrowsePathsRequest request)OnTranslateBrowsePathsToNodeIds(string requestId, TranslateBrowsePathsResponse resonse)

ReadValues

This method is called to read values (i.e. the value of attribute with id = 13) of one or more nodes.

ParameterTypeDescription
requestIdStringA string which is returned in the callback
requestarray of ReadValuesRequestContains the nodes to read and the connection info

OnReadValues

This is the callback method for ReadValues.

ParameterTypeDescription
requestIdStringThe string which is passed in ReadValues
responsearray of ReadValuesResponseContains the values of the nodes if successful.

The second parameter is an array of ReadValuesResponse, and contains the values (i.e. the value of attribute with id = 13) of the nodes or an error code if unsuccessful. The order of the arrays are the same as the order of the arrays in ReadValues.

WriteValues

This method is called to write values (i.e. the value of attribute with id = 13) to one or more nodes.

ParameterTypeDescription
requestIdStringA string which is returned in the callback
requestarray of WriteValuesRequestContains the nodes and values to write and the connection info

OnWriteValues

This is the callback method for WriteValues.

ParameterTypeDescription
requestIdStringThe string which is passed in WriteValues
responsearray of WriteValuesResponseContains the status of the write operation.

ReadDataTypes

This method is called to read datatypes (i.e. the value of attribute with id = 14) of one or more nodes.

ParameterTypeDescription
requestIdStringA string which is returned in the callback
requestReadDataTypesRequestContains the nodes to read and the connection info

OnReadDataTypes

This is the callback method for ReadDataTypes.

ParameterTypeDescription
requestIdStringThe string which is passed in ReadDataTypes
responsearray of ReadDataTypesResponseContains the datatypes of the nodes if successful.

ReadAttributes

This method is called to read attributes of one or more nodes.

ParameterTypeDescription
requestIdStringA string which is returned in the callback
requestarray of ReadAttributesRequestContains the nodes and attribute ids to read and the connection info

OnReadAttributes

This is the callback method for ReadAttributes.

ParameterTypeDescription
requestIdStringThe string which is passed in ReadAttributes
responsearray of ReadAttributesResponseContains the values of the attributes of the nodes if successful.

The second parameter is an array of ReadAttributesResponse, and contains the values of the attributes or an error code if unsuccessful. The order of the arrays are the same as the order of the arrays in ReadAttributes.

WriteAttributes

This method is called to write attributes to one or more nodes.

ParameterTypeDescription
requestIdStringA string which is returned in the callback
requestarray of WriteAttributesRequestContains the nodes, attribute ids and values to write and the connection info

OnWriteAttributes

This is the callback method for WriteAttributes.

ParameterTypeDescription
requestIdStringThe string which is passed in WriteAttributes
responsearray of WriteAttributesResponseContains the status of the write operation.

HistoryReadRaw

This method reads raw history data from an OPC UA Server.

ParameterTypeDescription
requestIdStringA string which is returned in the callback
requestReadHistoryRawValuesRequestContains the nodes, attribute ids to read and the connection info

OnOnHistoryReadRaw

This is the callback method for HistoryReadRaw.

ParameterTypeDescription
requestIdStringThe string which is passed in HistoryReadRaw
responseReadHistoryRawValuesResponseContains the result of the read operation.

HistoryReadProcessed

This method reads processed data from an OPC UA Server.

ParameterTypeDescription
requestIdStringA string which is returned in the callback
requestReadHistoryProcessedValuesRequestContains the nodes, attribute ids and other arguments needed for reading processed data.

OnHistoryReadProcessed

This is the callback method for HistoryReadProcessed.

ParameterTypeDescription
requestIdStringThe string which is passed in HistoryReadProcessed
responseReadHistoryProcessedValuesResponseContains the result of the read operation.

GetHistoricalAggregates

This method gets the available historical aggregates from an OPC UA Server.

ParameterTypeDescription
requestIdStringA string which is returned in the callback
requestHistoricalAggregateRequest

OnGetHistoricalAggregates

This is the callback method for GetHistoricalAggregates.

ParameterTypeDescription
requestIdStringThe string which is passed in GetHistoricalAggregates
responseHistoryAggregateResponseContains the historical aggregates for the OPC UA Server.

HistoryWriteValues

This method writes historical data to an OPC UA Server.

ParameterTypeDescription
requestIdStringA string which is returned in the callback
requestHistoryWriteRequestContains the values to write.

OnHistoryWriteValues

This is the callback method for HistoryWriteValues.

ParameterTypeDescription
requestIdStringThe string which is passed in HistoryWriteValues
responseHistoryWriteResponseContains the result of the write operation.

ReadEventsHistory

This method reads the event history from an OPC UA Server.

ParameterTypeDescription
requestIdStringA string which is returned in the callback
requestReadEventHistoryRequestContains the information needed for reading event history

OnReadEventsHistory

This is the callback method for ReadEventsHistory.

ParameterTypeDescription
requestIdStringThe string which is passed in ReadEventsHistory
responseReadEventHistoryResponseContains the historical events.

ReadEventsHistoryExtended

This method reads the event history from an OPC UA Server. The difference between this method and ReadEventsHistory is that the fields to be queried for are not predefined.

ParameterTypeDescription
requestIdStringA string which is returned in the callback
requestReadEventHistoryExtendedRequestContains the information needed for reading event history

OnReadEventsHistoryExtended

This is the callback method for ReadEventsHistoryExtended.

ParameterTypeDescription
requestIdStringThe string which is passed in ReadEventsHistoryExtended
responseReadEventHistoryExtendedResponseContains the historical events.

WriteEventsHistory

This method writes event history to an OPC UA Server.

ParameterTypeDescription
requestIdStringA string which is returned in the callback
requestWriteEventHistoryRequestContains the information needed for writing event history

OnWriteEventsHistory

This is the callback method for WriteEventsHistory.

ParameterTypeDescription
requestIdStringThe string which is passed in WriteEventsHistory
responseWriteEventHistoryResponseContains the result of the write operation.

WriteEventsHistoryExtended

This method writes event history to an OPC UA Server.

ParameterTypeDescription
requestIdStringA string which is returned in the callback
requestWriteEventHistoryExtendedRequestContains the information needed for writing event history

OnWriteEventsHistoryExtended

This is the callback method for WriteEventsHistoryExtended.

ParameterTypeDescription
requestIdStringThe string which is passed in WriteEventsHistoryExtended
responseWriteEventHistoryExtendedResponseContains the result of the write operation.

GetEventFields

This method gets the predefined event fields. These event fields are usually the most queried, and are available for querying in an easy way. This can be seen in ReadEventHistoryRequest.

ParameterTypeDescription
requestIdStringA string which is returned in the callback

OnEventFieldsFetched

This is the callback method for GetEventFields.

ParameterTypeDescription
requestIdStringThe string which is passed in GetEventFields
responsearray of EventFieldDefinitionContains the predefined events which can be queried in ReadEventHistoryRequest.

GetEventTypes

This method gets Event types.

ParameterTypeDescription
requestIdStringA string which is returned in the callback
requestGetEventTypesRequestContains the information needed getting event-types

OnGetEventTypes

This is the callback method for GetEventTypes.

ParameterTypeDescription
requestIdStringThe string which is passed in GetEventTypes
responseGetEventTypesResponseContains the event types.

AddEventComments

This method adds comment to an event.

ParameterTypeDescription
requestIdStringA string which is returned in the callback
requestarray of AddCommentRequestContains the event id and comment

OnEventsCommented

This is the callback method for AddEventComments.

ParameterTypeDescription
requestIdStringThe string which is passed in AddEventComments
responsearray of AddCommentResponseThe response tells whether the AddComment was successful.

ConfirmEvents

This method confirms events.

ParameterTypeDescription
requestIdStringA string which is returned in the callback
requestarray of ConfirmRequestContains the event id and comment

OnEventsConfirmed

This is the callback method for ConfirmEvents.

ParameterTypeDescription
requestIdStringThe string which is passed in ConfirmEvents
responsearray of ConfirmResponseThe response tells whether the Confirm was successful.

AcknowledgeEvents

This method acknowledges events.

ParameterTypeDescription
requestIdStringA string which is returned in the callback
requestarray of AcknowledgeRequestContains the event id and comment

OnEventsAcknowledged

This is the callback method for AcknowledgeEvents.

ParameterTypeDescription
requestIdStringThe string which is passed in AcknowledgeEvents
responsearray of AcknowledgeResponseThe response tells whether the Acknowledge was successful.

CreateEventSubscription

This method creates an event subscription. When subscribing to events two callback methods are involved. First the OnEventSubscriptionCreated is invoked telling whether the subscription was created correctly. Then as events happen the OnEvents method will be invoked, containing all the events which have occured since the last OnEvents call. The first OnEvents call after a successful event subscription has occured, will contain the current state of all the applicable event sources.

ParameterTypeDescription
requestIdStringA string which is returned in the callback
requestCreateEventSubscriptionRequestContains the information needed to create event subscription

OnEventSubscriptionCreated

This is the callback method invoked after the CreateEventSubscription has been called.

ParameterTypeDescription
requestIdStringThe string which is passed in CreateEventSubscription.
responseCreateEventSubscriptionResponseThe response tells whether the subscription has been created successfully.

OnEvents

This is the callback method invoked when the events have occured for the subscription.

ParameterTypeDescription
responseEventsChangedResponseContains the events which have occured since the previous OnEvents invocation.

CloseEventSubscription

This method closes (stops) an event subscription. If this method is not called, it will be automatically called when the client disconnects.

ParameterTypeDescription
requestIdStringA string which is returned in the callback
requestCloseEventSubscriptionRequestContains the id of the subscription to be closed.

OnEventSubscriptionClosed

This is the callback method for CloseEventSubscription.

ParameterTypeDescription
requestIdStringThe string which is passed in CloseEventSubscription.
responseCloseEventSubscriptionResponseThe response tells whether the subscription has been closed successfully.

CreateDataValueSubscription

This method creates a data value subscription. When subscribing to data values two callback methods are involved. First the OnDataValueSubscriptionCreated is invoked telling whether the subscription was created correctly. Then as data values change the OnDataValuesUpdate method will be invoked, containing all the data values which have changed since the last OnDataValuesUpdate call.

ParameterTypeDescription
requestIdStringA string which is returned in the callback
requestCreateDataValueSubscriptionRequestContains the information needed to create data value subscription
startSubscriptionBooleanIf true the subscription starts right away. If false the StartDataValueSubscription has to be called.

OnDataValueSubscriptionCreated

This is the callback method invoked after the CreateDataValueSubscription has been called.

ParameterTypeDescription
requestIdStringThe string which is passed in CreateDataValueSubscription.
responseCreateDataValueSubscriptionResponseThe response tells whether the subscription has been created successfully.

OnDataValuesUpdate

This is the callback method invoked when the data values have changed for the subscription.

ParameterTypeDescription
responseDataValuesChangedResponseContains the data values which have changed since the previous OnDataValuesUpdate invocation.

CloseDataValueSubscription

This method closes (stops) a data value subscription. If this method is not called, it will be automatically called when the client disconnects.

ParameterTypeDescription
requestIdStringA string which is returned in the callback
requestCloseDataValueSubscriptionRequestContains the id of the subscription to be closed.

OnDataValueSubscriptionClosed

This is the callback method for CloseDataValueSubscription.

ParameterTypeDescription
requestIdStringThe string which is passed in CloseDataValueSubscription.
responseCloseDataValueSubscriptionResponseThe response tells whether the subscription has been closed successfully.

StartDataValueSubscription

This method starts a subscription created by CreateDataValueSubscription.

ParameterTypeDescription
requestIdStringA string which is returned in the callback.
subscriptionidStringThe id of the subscription to be started.

OnDataValueSubscriptionStarted

This is the callback method for StartDataValueSubscription.

ParameterTypeDescription
requestIdStringThe string which is passed in StartDataValueSubscription.
responseStartDataValueSubscriptionResponseThe response tells whether the subscription has been started successfully.

GetNamespaces

This method gets the namespaces of a OPC UA Server.

ParameterTypeDescription
requestIdStringA string which is returned in the callback.
requestNamespacesRequest

OnNamespacesFetched

This is the callback method for GetNamespaces.

ParameterTypeDescription
requestIdStringThe string which is passed in GetNamespaces.
responseNamespaceResponseContains the namespaces

Browse

This method is used to browse the UA Address Space for nodes.

ParameterTypeDescription
requestIdStringA string which is returned in the callback.
requestBrowseRequestThe information needed to start a browse operation.

OnBrowse

This is the callback method for Browse.

ParameterTypeDescription
requestIdStringThe string which is passed in Browse.
responseBrowseResponseContains the references to nodes.

BrowseMulti

This method is used to browse with multiple source nodes the UA Address Space for nodes.

ParameterTypeDescription
requestIdStringA string which is returned in the callback.
requestBrowseMultiRequestBrowse request

OnBrowseMulti

This is the callback method for BrowseMulti.

ParameterTypeDescription
requestIdStringThe string which is passed in BrowseMulti.
responseMultiBrowseResponseContains the references to nodes.

BrowseChildren

This method is used to browse the UA Address Space for children nodes. The children nodes are defined as nodes of node class: Variable, Object, DataType, VariableType or ObjectType.

ParameterTypeDescription
requestIdStringA string which is returned in the callback.
requestChildrenRequestThe information needed to start a browse children operation.

OnBrowseChildren

This is the callback method for BrowseChildren.

ParameterTypeDescription
requestIdStringThe string which is passed in BrowseChildren.
responseBrowseResponseContains the references to nodes.

BrowseProperties

This method is used to browse the UA Address Space for properties. The property nodes are defined as nodes of node class: Variable which has a HasProperty reference.

ParameterTypeDescription
requestIdStringA string which is returned in the callback.
requestBrowsePropertiesRequestThe information needed to start a browse for properties operation.

OnBrowseProperties

This is the callback method for BrowseProperties.

ParameterTypeDescription
requestIdStringThe string which is passed in BrowseProperties.
responseBrowseResponseContains the references to nodes.

BrowsePropertiesMulti

This method is used to browse the UA Address Space for properties. The property nodes are defined as nodes of node class: Variable which has a HasProperty reference.

ParameterTypeDescription
requestIdStringA string which is returned in the callback.
requestBrowsePropertiesMultiRequestThe information needed to start a browse for properties operation.

OnBrowsePropertiesMulti

This is the callback method for BrowsePropertiesMulti.

ParameterTypeDescription
requestIdStringThe string which is passed in BrowsePropertiesMulti.
responseMultiBrowseResponseContains the references to nodes.

TranslateBrowsePathsToNodeIds

Translates browse paths to node ids.

ParameterTypeDescription
requestIdStringA string which is returned in the callback.
requestTranslateBrowsePathsRequestContains starting nodes and relative paths.

OnTranslateBrowsePathsToNodeIds

This is the callback method for TranslateBrowsePathsToNodeIds.

ParameterTypeDescription
requestIdStringThe string which is passed in TranslateBrowsePathsToNodeIds.
responseTranslateBrowsePathsResponseContains the node ids for the relative paths.