mirror of
https://github.com/OPCFoundation/UA-.NETStandard.git
synced 2026-10-28 22:55:49 +08:00
add hostname to published data
This commit is contained in:
@@ -217,6 +217,12 @@ namespace NetCoreConsolePublisher
|
||||
|
||||
JsonEncoder encoder = new JsonEncoder(
|
||||
monitoredItem.Subscription.Session.MessageContext, false);
|
||||
string hostname = monitoredItem.Subscription.Session.ConfiguredEndpoint.EndpointUrl.DnsSafeHost;
|
||||
if (hostname == "localhost")
|
||||
{
|
||||
hostname = Utils.GetHostName();
|
||||
}
|
||||
encoder.WriteString("HostName", hostname);
|
||||
encoder.WriteNodeId("MonitoredItem", monitoredItem.ResolvedNodeId);
|
||||
e.NotificationValue.Encode(encoder);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user