Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Integration Service

SignalRPubSubClient

  • Last UpdatedJun 24, 2025
  • 1 minute read

SignalRPubSubClient is a singleton object, one client connection for the single instance of the application. Once you instantiate the PubSubClient object it can internally establish the connection to the Hub Server and from their you can directly Publish, Subscribe to any topics that you want to.

Need to create one delegate event handler to receive the notifications once we make a subscription to the specific topic/datasourcename

var pubSubClient = await SignalRHubConnectionFactory.CreatePubSubClient(AuthenticationType.NTLM, signalRUri);

pubSubClient.MessagePublished += OnMessagePublished;

public void OnMessagePublished(object source, PubSubMessageEventArgs eventArgs)

{

}

public void OnMessagePublished(object source, PubSubMessageEventArgs eventArgs)

{

}

Once you create a client then you make publish and subscribe requests from the client itself await pubSubClient.Subscribe(nameToSubscribe);

// nameToSubscribe will be topic which you want to make subscribe to the hub

// Publish Message

public static async void PublishNotification(string topic, MessageDto message)

{

try

{

string pubSubUri = // DataAPI Uri

var pubSubClient =await SignalRHubConnectionFactory.CreatePubSubClient(AuthenticationType.NTLM, pubSubUri);

PubSubMessage pubSubMessage = GeneratePubSubMessage(message);

var result = await pubSubClient.Publish(pubSubMessage, topic);

}

catch (Exception ex)

{

}

}

private static PubSubMessage GeneratePubSubMessage(MessageDto message)

{

return new PubSubMessage

{

Topic = //Topic,

Context = // dynamic: Json string of List<KeyValuePair<string,string>> or Dicrionary<string, string>

};

}

UnSubscribe

var result = await pubSubClient.Unsubscribe(dataSourceName); //datasourcename or topic name

Related Links
TitleResults for “How to create a CRG?”Also Available in