The Connection class

The Connection class from the BestHTTP.SignalR namespace manages an abstract connection to the SignalR server. Connecting to a SignalR server start with the creation of a Connection object. This class will keep track of the current state of the protocol and will fire events.

You can create a Connection object multiple ways:

using BestHTTP.SignalR;

Uri uri = new Uri("http://my-signalr-site/raw-connection/");
Connection signalRConnection = new Connection(uri);
Connection signalRConnection = new Connection(uri, "hub1", "hub2", "hubN");
Hub hub1 = new Hub("hub1");
Hub hub2 = new Hub("hub2");
Hub hubN = new Hub("hubN");
Connection signalRConnection = new Connection(uri, hub1, hub2, hubN);

You can’t mix options 2 and 3.

After we created the Connection, we can start to connect to the server by calling the Open() function on it:

signalRConnection.Open();