3
votes

I have C# code that works to use a local SignalR server to pass messages between WinForms apps.

I want to revise this code to use the Azure SignalR service.

I created the SignalR resource in the Azure Portal.

I have a connection string that looks like this

Endpoint=[endpoint URI here];AccessKey=[guid here];

so I have a connection string and an AccessKey.

How do I allocate a HubConnection from a WinForms/console app (not a .Net core web app) and use a connection string or assign an AccessKey to the connection?

My current (non-Azure) code just does

var myConnection = new HubConnection(theURI);

Thanks,

Adam

1

1 Answers

4
votes

The client code doesn't change when you use SignalR service. The connection string is used at server side (you still need to have a server when using SignalR service, which hosts the hub logic and does authentication). You client code connects to the server first (using the same API) and server will redirect client to connect to service.