Share via


HubPipelineModule Class

.NET Framework 4

Common base class to simplify the implementation of IHubPipelineModules. A module can intercept and customize various stages of hub processing such as connecting, reconnecting, disconnecting, invoking server-side hub methods, invoking client-side hub methods, authorizing hub clients and rejoining hub groups. A module can be activated by calling AddModule(IHubPipelineModule) . The combined modules added to the IHubPipeline are invoked via the IHubPipelineInvoker interface.

Inheritance Hierarchy

System.Object
  Microsoft.AspNet.SignalR.Hubs.HubPipelineModule
    Microsoft.AspNet.SignalR.Hubs.AuthorizeModule

Namespace:  Microsoft.AspNet.SignalR.Hubs
Assembly:  Microsoft.AspNet.SignalR.Core (in Microsoft.AspNet.SignalR.Core.dll)

Syntax

'Declaration
Public MustInherit Class HubPipelineModule _
    Implements IHubPipelineModule
'Usage
Dim instance As HubPipelineModule
public abstract class HubPipelineModule : IHubPipelineModule
public ref class HubPipelineModule abstract : IHubPipelineModule
[<AbstractClassAttribute>]
type HubPipelineModule =  
    class 
        interface IHubPipelineModule 
    end
public abstract class HubPipelineModule implements IHubPipelineModule

The HubPipelineModule type exposes the following members.

Constructors

  Name Description
Protected method HubPipelineModule

Top

Methods

  Name Description
Public method BuildAuthorizeConnect Wraps a function to be called before a client subscribes to signals belonging to the hub described by the HubDescriptor . By default, the AuthorizeModule will look for attributes on the IHub to help determine if the client is authorized to subscribe to method invocations for the described hub. The function returns true if the client is authorized to subscribe to client-side hub method invocations; false, otherwise.
Public method BuildConnect Wraps a function that is called when a client connects to the HubDispatcher for each IHub the client connects to. By default, this results in the IHub 's OnConnected method being invoked.
Public method BuildDisconnect Wraps a function that is called when a client disconnects from the HubDispatcher for each IHub the client was connected to. By default, this results in the IHub 's OnDisconnected method being invoked.
Public method BuildIncoming Wraps a function that invokes a server-side hub method. Even if a client has not been authorized to connect to a hub, it will still be authorized to invoke server-side methods on that hub unless it is prevented in BuildIncoming(Func<IHubIncomingInvokerContext, Task<Object>>) by not executing the invoke parameter.
Public method BuildOutgoing Wraps a function that invokes a client-side hub method.
Public method BuildReconnect Wraps a function that is called when a client reconnects to the HubDispatcher for each IHub the client connects to. By default, this results in the IHub 's OnReconnected method being invoked.
Public method BuildRejoiningGroups Wraps a function that determines which of the groups belonging to the hub described by the HubDescriptor the client should be allowed to rejoin. By default, clients that are reconnecting to the server will be removed from all groups they may have previously been a member of, because untrusted clients may claim to be a member of groups they were never authorized to join.
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 OnAfterConnect This method is called after the connect components of any modules added later to the IHubPipeline are executed and after OnConnected() is executed, if at all.
Protected method OnAfterDisconnect This method is called after the disconnect components of any modules added later to the IHubPipeline are executed and after OnDisconnected() is executed, if at all.
Protected method OnAfterIncoming This method is called after the incoming components of any modules added later to the IHubPipeline and the server-side hub method have completed execution.
Protected method OnAfterOutgoing This method is called after the outgoing components of any modules added later to the IHubPipeline are executed. This does not mean that all the clients have received the hub method invocation, but it does indicate a hub invocation message has successfully been published to a message bus.
Protected method OnAfterReconnect This method is called after the reconnect components of any modules added later to the IHubPipeline are executed and after OnReconnected() is executed, if at all.
Protected method OnBeforeAuthorizeConnect This method is called before the AuthorizeConnect components of any modules added later to the IHubPipeline are executed. If this returns false, then those later-added modules will not run and the client will not be allowed to subscribe to client-side invocations of methods belonging to the hub defined by the HubDescriptor .
Protected method OnBeforeConnect This method is called before the connect components of any modules added later to the IHubPipeline are executed. If this returns false, then those later-added modules and the OnConnected() method will not be run.
Protected method OnBeforeDisconnect This method is called before the disconnect components of any modules added later to the IHubPipeline are executed. If this returns false, then those later-added modules and the OnDisconnected() method will not be run.
Protected method OnBeforeIncoming This method is called before the incoming components of any modules added later to the IHubPipeline are executed. If this returns false, then those later-added modules and the server-side hub method invocation will not be executed. Even if a client has not been authorized to connect to a hub, it will still be authorized to invoke server-side methods on that hub unless it is prevented in BuildIncoming(Func<IHubIncomingInvokerContext, Task<Object>>) by not executing the invoke parameter or prevented in OnBeforeIncoming(IHubIncomingInvokerContext) by returning false.
Protected method OnBeforeOutgoing This method is called before the outgoing components of any modules added later to the IHubPipeline are executed. If this returns false, then those later-added modules and the client-side hub method invocation(s) will not be executed.
Protected method OnBeforeReconnect This method is called before the reconnect components of any modules added later to the IHubPipeline are executed. If this returns false, then those later-added modules and the OnReconnected() method will not be run.
Protected method OnIncomingError This is called when an uncaught exception is thrown by a server-side hub method or the incoming component of a module added later to the IHubPipeline . Observing the exception using this method will not prevent it from bubbling up to other modules.
Public method ToString (Inherited from Object.)

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.Hubs Namespace