Share via


HubConnection Class

.NET Framework 4.5

A Connection for interacting with Hubs.

Inheritance Hierarchy

System.Object
  Microsoft.AspNet.SignalR.Client.Connection
    Microsoft.AspNet.SignalR.Client.HubConnection

Namespace:  Microsoft.AspNet.SignalR.Client
Assembly:  Microsoft.AspNet.SignalR.Client (in Microsoft.AspNet.SignalR.Client.dll)

Syntax

'Declaration
Public Class HubConnection _
    Inherits Connection _
    Implements IHubConnection, IConnection
'Usage
Dim instance As HubConnection
public class HubConnection : Connection, 
    IHubConnection, IConnection
public ref class HubConnection : public Connection, 
    IHubConnection, IConnection
type HubConnection =  
    class 
        inherit Connection 
        interface IHubConnection 
        interface IConnection 
    end
public class HubConnection extends Connection implements IHubConnection, IConnection

The HubConnection type exposes the following members.

Constructors

  Name Description
Public method HubConnection(String) Initializes a new instance of the HubConnection class.
Public method HubConnection(String, Boolean) Initializes a new instance of the HubConnection class.
Public method HubConnection(String, IDictionary<String, String>) Initializes a new instance of the HubConnection class.
Public method HubConnection(String, String) Initializes a new instance of the HubConnection class.
Public method HubConnection(String, IDictionary<String, String>, Boolean) Initializes a new instance of the HubConnection class.
Public method HubConnection(String, String, Boolean) Initializes a new instance of the HubConnection class.

Top

Properties

  Name Description
Public property ConnectionId Gets or sets the connection id for the connection. (Inherited from Connection.)
Public property ConnectionToken Gets or sets the connection token for the connection. (Inherited from Connection.)
Public property CookieContainer Gets or sets the cookies associated with the connection. (Inherited from Connection.)
Public property Credentials Gets or sets authentication information for the connection. (Inherited from Connection.)
Public property GroupsToken Gets or sets the groups token for the connection. (Inherited from Connection.)
Public property Headers Gets or sets the headers for the requests (Inherited from Connection.)
Public property Items Gets a dictionary for storing state for the connection. (Inherited from Connection.)
Public property JsonSerializer Gets or sets the serializer used by the connection. (Inherited from Connection.)
Public property MessageId Gets or sets the last message id for the connection. (Inherited from Connection.)
Public property Protocol Gets or sets the protocol for the connection. (Inherited from Connection.)
Public property Proxy Gets or sets the proxy information for the connection. (Inherited from Connection.)
Public property QueryString Gets the query string specified in the constructor. (Inherited from Connection.)
Public property State Gets the current ConnectionState of the connection. (Inherited from Connection.)
Public property TraceLevel Gets or sets the trace level for the connection. (Inherited from Connection.)
Public property TraceWriter Gets or sets the text writer to trace the connection. (Inherited from Connection.)
Public property Transport Gets or sets the client transport for the connection. (Inherited from Connection.)
Public property TransportConnectTimeout Gets or sets a TimeSpan representing the amount of time to transport connection before timing out. (Inherited from Connection.)
Public property Url Gets or sets the url for the connection. (Inherited from Connection.)

Top

Methods

  Name Description
Public method AddClientCertificate Adds a client certificate to the request. (Inherited from Connection.)
Public method CreateHubProxy Creates an IHubProxy for the hub with the specified name.
Public method Dispose() Stop the connection, equivalent to calling connection stop. (Inherited from Connection.)
Protected method Dispose(Boolean) Stop the connection, equivalent to calling connection stop. (Inherited from Connection.)
Public method Equals (Inherited from Object.)
Protected method Finalize (Inherited from Object.)
Public method GetHashCode (Inherited from Object.)
Public method GetType (Inherited from Object.)
Protected method MemberwiseClone (Inherited from Object.)
Protected method OnClosed (Overrides Connection.OnClosed().)
Protected method OnMessageReceived (Overrides Connection.OnMessageReceived(JToken).)
Public method OnReconnecting (Overrides Connection.OnReconnecting().)
Protected method OnSending (Overrides Connection.OnSending().)
Public method Send(Object) Sends an object that will be JSON serialized asynchronously over the connection. (Inherited from Connection.)
Public method Send(String) Sends data asynchronously over the connection. (Inherited from Connection.)
Public method Start() Starts the Connection. (Inherited from Connection.)
Public method Start(IClientTransport) Starts the Connection. (Inherited from Connection.)
Public method Start(IHttpClient) Starts the Connection. (Inherited from Connection.)
Public method Stop() Stops the Connection and sends an abort message to the server. (Inherited from Connection.)
Public method Stop(TimeSpan) Stops the Connection and sends an abort message to the server. <param name="timeout">The timeout</param>. (Inherited from Connection.)
Public method ToString (Inherited from Object.)
Public method Trace Traces a connection method that is specified by the parameters. (Inherited from Connection.)

Top

Events

  Name Description
Public event Closed Occurs when connection is stopped. (Inherited from Connection.)
Public event ConnectionSlow Occurs when the Connection is about to timeout. (Inherited from Connection.)
Public event Error Occurs when the Connection has encountered an error. (Inherited from Connection.)
Public event Received Occurs when the Connection has received data from the server. (Inherited from Connection.)
Public event Reconnected Occurs when the Connection successfully reconnects after a timeout. (Inherited from Connection.)
Public event Reconnecting Occurs when the Connection starts reconnecting after an error. (Inherited from Connection.)
Public event StateChanged Occurs when the Connection state changes. (Inherited from Connection.)

Top

Extension Methods

  Name Description
Public Extension Method AsObservable() Overloaded. (Defined by ConnectionExtensions.)
Public Extension Method AsObservable<T>() Overloaded. (Defined by ConnectionExtensions.)
Public Extension Method AsObservable<T>(Func<String, T>) Overloaded. (Defined by ConnectionExtensions.)
Public Extension Method EnsureReconnecting (Defined by ConnectionExtensions.)
Public Extension Method GetValue<T> (Defined by ConnectionExtensions.)
Public Extension Method JsonDeserializeObject<T> (Defined by ConnectionExtensions.)
Public Extension Method JsonSerializeObject (Defined by ConnectionExtensions.)

Top

Explicit Interface Implementations

  Name Description
Explicit interface implemetationPrivate property IConnection.Certificates Gets a collection that stores X509Certificate objects. (Inherited from Connection.)
Explicit interface implemetationPrivate method IConnection.ChangeState Called when the connection to change state. (Inherited from Connection.)
Explicit interface implemetationPrivate method IConnection.Disconnect Stops the Connection without sending an abort message to the server. This function is called after we receive a disconnect message from the server. (Inherited from Connection.)
Explicit interface implemetationPrivate property IConnection.KeepAliveData Gets or sets an object to store the various keep alive timeout values. (Inherited from Connection.)
Explicit interface implemetationPrivate method IConnection.OnConnectionSlow Called when the Connection is about to timeout. (Inherited from Connection.)
Explicit interface implemetationPrivate method IConnection.OnError Called when the Connection has encountered an error. (Inherited from Connection.)
Explicit interface implemetationPrivate method IConnection.OnReceived Called when the Connection has received data from the server. (Inherited from Connection.)
Explicit interface implemetationPrivate method IConnection.OnReconnected Called when the Connection successfully reconnects after a timeout. (Inherited from Connection.)
Explicit interface implemetationPrivate method IConnection.PrepareRequest Prepares all request for the Connection. (Inherited from Connection.)
Explicit interface implemetationPrivate method IConnection.UpdateLastKeepAlive Sets LastKeepAlive to the current time. (Inherited from Connection.)
Explicit interface implemetationPrivate method IHubConnection.RegisterCallback
Explicit interface implemetationPrivate method IHubConnection.RemoveCallback

Top

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.AspNet.SignalR.Client Namespace