Uni.UaClient 1.0.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package Uni.UaClient --version 1.0.4
                    
NuGet\Install-Package Uni.UaClient -Version 1.0.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Uni.UaClient" Version="1.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Uni.UaClient" Version="1.0.4" />
                    
Directory.Packages.props
<PackageReference Include="Uni.UaClient" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Uni.UaClient --version 1.0.4
                    
#r "nuget: Uni.UaClient, 1.0.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Uni.UaClient@1.0.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Uni.UaClient&version=1.0.4
                    
Install as a Cake Addin
#tool nuget:?package=Uni.UaClient&version=1.0.4
                    
Install as a Cake Tool

robot

opc-ua-client

Actions Status

Communicate using OPC Unified Architecture and Visual Studio. With this library, your app can browse, read, write and subscribe to the live data published by the OPC UA servers on your network.

Supports .NET Core, Universal Windows Platform (UWP), Windows Presentation Framework (WPF) and Xamarin applications.

Industrial Resilient Client (Out-of-the-Box 24×7)

For mission-critical shop floor, SCADA, and background services, use Uni.UaClient.Resilient.OpcClient. It encapsulates automatic reconnection with exponential backoff, single-flight session concurrency locks, non-intrusive industrial network probes, self-healing subscriptions, and PLC handshakes:

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Uni.UaClient.Resilient;
using Uni.UaClient.Resilient.Operations;
using Uni.UaClient.Resilient.Options;

// 1. Configure and connect
await using var client = new OpcClient(new OpcClientOptions
{
    EndpointUrl = "opc.tcp://192.168.1.100:4840",
    AutoReconnect = true,
    ReconnectBaseDelay = TimeSpan.FromSeconds(1),
    ReconnectMaxDelay = TimeSpan.FromSeconds(30)
});
await client.ConnectAsync();

// 2. Strongly-typed read and write
double speed = await client.ReadNodeAsync<double>("ns=2;s=Line1.Speed");
await client.WriteNodeAsync("ns=2;s=Line1.SetPoint", 1500.0);

// 3. Self-healing subscriptions with System.Threading.Channels decoupling
var sub = client.CreateSubscription(publishingInterval: 250);
await sub.AddNodeAsync("ns=2;s=Line1.Trigger", (nodeId, dataValue, _) =>
{
    Console.WriteLine($"[Update] {nodeId} = {dataValue.Value}");
    return Task.CompletedTask;
});

// 4. Closed-loop PLC handshake (Write Request -> Wait Condition -> Auto Reset)
var result = await client.HandshakeAsync(new HandshakeRequest
{
    RequestNodes = new Dictionary<string, object> { ["ns=2;s=Machine.Trigger"] = 1 },
    ResponseNodeId = "ns=2;s=Machine.Feedback",
    Condition = val => Convert.ToInt32(val.Value) == 2,
    ResetNodes = new Dictionary<string, object> { ["ns=2;s=Machine.Trigger"] = 0 },
    AlwaysResetOnFailure = true,
    Timeout = TimeSpan.FromSeconds(5)
});

ASP.NET Core / Generic Host Dependency Injection:

services.AddResilientOpcClient(options =>
{
    options.EndpointUrl = "opc.tcp://192.168.1.100:4840";
    options.AutoReconnect = true;
});

Low-Level Session Channel (Getting Started)

Install package Uni.UaClient from Nuget to get the latest release for your hmi project.

Here's an example of reading the variable ServerStatus using the low-level ClientSessionChannel.

using System;
using System.Threading.Tasks;
using Uni.UaClient;
using Uni.UaClient.Channels;
					
public class Program
{
    /// <summary>
    /// Connects to server and reads the current ServerState. 
    /// </summary>
    public static async Task Main()
    {
        // describe this client application.
        var clientDescription = new ApplicationDescription
        {
            ApplicationName = "Uni.UaClient.FeatureTests",
            ApplicationUri = $"urn:{System.Net.Dns.GetHostName()}:Uni.UaClient.FeatureTests",
            ApplicationType = ApplicationType.Client
        };

        // create a 'ClientSessionChannel', a client-side channel that opens a 'session' with the server.
        var channel = new ClientSessionChannel(
            clientDescription,
            null, // no x509 certificates
            new AnonymousIdentity(), // no user identity
            "opc.tcp://opcua.umati.app:4840", // the public endpoint of the umati sample server.
            SecurityPolicyUris.None); // no encryption
        try
        {
            // try opening a session and reading a few nodes.
            await channel.OpenAsync();

            Console.WriteLine($"Opened session with endpoint '{channel.RemoteEndpoint.EndpointUrl}'.");
            Console.WriteLine($"SecurityPolicy: '{channel.RemoteEndpoint.SecurityPolicyUri}'.");
            Console.WriteLine($"SecurityMode: '{channel.RemoteEndpoint.SecurityMode}'.");
            Console.WriteLine($"UserIdentityToken: '{channel.UserIdentity}'.");

            // build a ReadRequest. See 'OPC UA Spec Part 4' paragraph 5.10.2
            var readRequest = new ReadRequest {
                // set the NodesToRead to an array of ReadValueIds.
                NodesToRead = new[] {
                    // construct a ReadValueId from a NodeId and AttributeId.
                    new ReadValueId {
                        // you can parse the nodeId from a string.
                        // e.g. NodeId.Parse("ns=2;s=Demo.Static.Scalar.Double")
                        NodeId = NodeId.Parse(VariableIds.Server_ServerStatus),
                        // variable class nodes have a Value attribute.
                        AttributeId = AttributeIds.Value
                    }
                }
            };
            // send the ReadRequest to the server.
            var readResult = await channel.ReadAsync(readRequest);

            // DataValue is a class containing value, timestamps and status code.
            // the 'Results' array returns DataValues, one for every ReadValueId.
            var serverStatus = readResult.Results[0].GetValueOrDefault<ServerStatusDataType>();

            Console.WriteLine("\nServer status:");
            Console.WriteLine("  ProductName: {0}", serverStatus.BuildInfo.ProductName);
            Console.WriteLine("  SoftwareVersion: {0}", serverStatus.BuildInfo.SoftwareVersion);
            Console.WriteLine("  ManufacturerName: {0}", serverStatus.BuildInfo.ManufacturerName);
            Console.WriteLine("  State: {0}", serverStatus.State);
            Console.WriteLine("  CurrentTime: {0}", serverStatus.CurrentTime);

            Console.WriteLine($"\nClosing session '{channel.SessionId}'.");
            await channel.CloseAsync();
        }
        catch(Exception ex)
        {
		 	 await channel.AbortAsync();
            Console.WriteLine(ex.Message);
        }
    }
}

// Server status:
//   ProductName: open62541 OPC UA Server
//   SoftwareVersion: 1.4.0-rc1
//   ManufacturerName: open62541
//   State: Running

Model, View, ViewModel (MVVM)

For HMI applications, you can use XAML bindings to connect your UI elements to live data.

First add a UaApplication instance and initialize it during startup:

public partial class App : Application
{
    private UaApplication application;

    protected override void OnStartup(StartupEventArgs e)
    {
        // Build and run an OPC UA application instance.
        this.application = new UaApplicationBuilder()
            .SetApplicationUri($"urn:{Dns.GetHostName()}:Uni.StatusHmi")
            .SetDirectoryStore($"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}\\Uni.StatusHmi\\pki")
            .SetIdentity(this.ShowSignInDialog)
            .Build();

        this.application.Run();

        // Create and show the main view.
        var view = new MainView();
        view.Show();
    }
	...
}

Then any view model can be transformed into a OPC UA subscription.

[Subscription(endpointUrl: "opc.tcp://localhost:48010", publishingInterval: 500, keepAliveCount: 20)]
public class MainViewModel : SubscriptionBase
{
    /// <summary>
    /// Gets the value of ServerServerStatus.
    /// </summary>
    [MonitoredItem(nodeId: "i=2256")]
    public ServerStatusDataType ServerServerStatus
    {
        get { return this.serverServerStatus; }
        private set { this.SetProperty(ref this.serverServerStatus, value); }
    }

    private ServerStatusDataType serverServerStatus;
}

Configure EndpointUrl at runtime (MVVM)

You can use a configuration file to replace all instances of an EndpointUrl at runtime. Use this approach to specify different endpoints for development versus production.

using Microsoft.Extensions.Configuration;

var config = new ConfigurationBuilder()
    .SetBasePath(Directory.GetCurrentDirectory())
    .AddJsonFile("appSettings.json", true)
    .Build();

var app = new UaApplicationBuilder()
    ...
    .AddMappedEndpoints(config)
    .Build();

[Subscription(endpointUrl: "MainPLC", publishingInterval: 500, keepAliveCount: 20)]
public class MainViewModel : SubscriptionBase
{
    /// <summary>
    /// Gets the value of ServerServerStatus.
    /// </summary>
    [MonitoredItem(nodeId: "i=2256")]
    public ServerStatusDataType ServerServerStatus
    {
        get { return this.serverServerStatus; }
        private set { this.SetProperty(ref this.serverServerStatus, value); }
    }

    private ServerStatusDataType serverServerStatus;
}

appSettings.json

{
  "MappedEndpoints": [
    {
      "RequestedUrl": "MainPLC",
      "Endpoint": {
        "EndpointUrl": "opc.tcp://192.168.1.100:48010",
        "SecurityPolicyUri": "http://opcfoundation.org/UA/SecurityPolicy#None"
      }
    }
  ]
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Uni.UaClient:

Package Downloads
Uni.UaClient.Dashboard

Embedded Swagger-like Web UI dashboard for OPC UA client browsing, drag-and-drop live subscriptions, and tag inspection (UaExpert layout).

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.5 105 10/21/2026
1.0.4 98 10/21/2026
1.0.3 104 10/20/2026
1.0.2 109 10/19/2026
1.0.1 106 10/16/2026