C# 클래스 Microsoft.AspNet.SignalR.Hubs.HubPipelineModule

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 IHubPipeline.AddModule. The combined modules added to the IHubPipeline are invoked via the IHubPipelineInvoker interface.
상속: IHubPipelineModule
파일 보기 프로젝트 열기: SignalR/SignalR

공개 메소드들

메소드 설명
BuildAuthorizeConnect ( Func authorizeConnect ) : Func

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.

BuildConnect ( Task>.Func connect ) : Task>.Func

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.

BuildDisconnect ( Func disconnect ) : Func

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.

BuildIncoming ( Func invoke ) : Task>.Func

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 IHubPipelineModule.BuildIncoming by not executing the invoke parameter.

BuildOutgoing ( Task>.Func send ) : Task>.Func

Wraps a function that invokes a client-side hub method.

BuildReconnect ( Task>.Func reconnect ) : Task>.Func

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.

BuildRejoiningGroups ( Func rejoiningGroups ) : Func,IList>

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 will rejoin all the groups they were in prior to reconnecting.

보호된 메소드들

메소드 설명
OnAfterConnect ( IHub hub ) : void

This method is called after the connect components of any modules added later to the IHubPipeline are executed and after IHub.OnConnected is executed, if at all.

OnAfterDisconnect ( IHub hub, bool stopCalled ) : void

This method is called after the disconnect components of any modules added later to the IHubPipeline are executed and after IHub.OnDisconnected(bool) is executed, if at all.

OnAfterIncoming ( object result, IHubIncomingInvokerContext context ) : object

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.

OnAfterOutgoing ( IHubOutgoingInvokerContext context ) : void

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 indicate a hub invocation message has successfully been published to a message bus.

OnAfterReconnect ( IHub hub ) : void

This method is called after the reconnect components of any modules added later to the IHubPipeline are executed and after IHub.OnReconnected is executed, if at all.

OnBeforeAuthorizeConnect ( HubDescriptor hubDescriptor, IRequest request ) : bool

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.

OnBeforeConnect ( IHub hub ) : bool

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 IHub.OnConnected method will not be run.

OnBeforeDisconnect ( IHub hub, bool stopCalled ) : bool

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 IHub.OnDisconnected(bool) method will not be run.

OnBeforeIncoming ( IHubIncomingInvokerContext context ) : bool

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 IHubPipelineModule.BuildIncoming by not executing the invoke parameter or prevented in HubPipelineModule.OnBeforeIncoming by returning false.

OnBeforeOutgoing ( IHubOutgoingInvokerContext context ) : bool

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.

OnBeforeReconnect ( IHub hub ) : bool

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 IHub.OnReconnected method will not be run.

OnIncomingError ( ExceptionContext exceptionContext, IHubIncomingInvokerContext invokerContext ) : void

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.

메소드 상세

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 BuildAuthorizeConnect ( Func authorizeConnect ) : Func
authorizeConnect Func /// A function that dictates whether or not the client is authorized to connect to the described Hub. ///
리턴 Func

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 BuildConnect ( Task>.Func connect ) : Task>.Func
connect Task>.Func A function to be called when a client connects to a hub.
리턴 Task>.Func

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 BuildDisconnect ( Func disconnect ) : Func
disconnect Func /// A task-returning function to be called when a client disconnects from a hub. /// This function takes two parameters: /// 1. The is being disconnected from. /// 2. A boolean, stopCalled, that is true if stop was called on the client and false if the client timed out. /// Timeouts can be caused by clients reconnecting to another SignalR server in scaleout. ///
리턴 Func

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 IHubPipelineModule.BuildIncoming by not executing the invoke parameter.
public BuildIncoming ( Func invoke ) : Task>.Func
invoke Func A function that invokes a server-side hub method.
리턴 Task>.Func

BuildOutgoing() 공개 메소드

Wraps a function that invokes a client-side hub method.
public BuildOutgoing ( Task>.Func send ) : Task>.Func
send Task>.Func A function that invokes a client-side hub method.
리턴 Task>.Func

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 BuildReconnect ( Task>.Func reconnect ) : Task>.Func
reconnect Task>.Func A function to be called when a client reconnects to a hub.
리턴 Task>.Func

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 will rejoin all the groups they were in prior to reconnecting.
public BuildRejoiningGroups ( Func rejoiningGroups ) : Func,IList>
rejoiningGroups Func A function that determines which groups the client should be allowed to rejoin.
리턴 Func,IList>

OnAfterConnect() 보호된 메소드

This method is called after the connect components of any modules added later to the IHubPipeline are executed and after IHub.OnConnected is executed, if at all.
protected OnAfterConnect ( IHub hub ) : void
hub IHub The hub the client has connected to.
리턴 void

OnAfterDisconnect() 보호된 메소드

This method is called after the disconnect components of any modules added later to the IHubPipeline are executed and after IHub.OnDisconnected(bool) is executed, if at all.
protected OnAfterDisconnect ( IHub hub, bool stopCalled ) : void
hub IHub The hub the client has disconnected from.
stopCalled bool /// true, if stop was called on the client closing the connection gracefully; /// false, if the client timed out. Timeouts can be caused by clients reconnecting to another SignalR server in scaleout. ///
리턴 void

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 OnAfterIncoming ( object result, IHubIncomingInvokerContext context ) : object
result object The return value of the server-side hub method
context IHubIncomingInvokerContext A description of the server-side hub method invocation.
리턴 object

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 indicate a hub invocation message has successfully been published to a message bus.
protected OnAfterOutgoing ( IHubOutgoingInvokerContext context ) : void
context IHubOutgoingInvokerContext A description of the client-side hub method invocation.
리턴 void

OnAfterReconnect() 보호된 메소드

This method is called after the reconnect components of any modules added later to the IHubPipeline are executed and after IHub.OnReconnected is executed, if at all.
protected OnAfterReconnect ( IHub hub ) : void
hub IHub The hub the client has reconnected to.
리턴 void

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 OnBeforeAuthorizeConnect ( HubDescriptor hubDescriptor, IRequest request ) : bool
hubDescriptor HubDescriptor A description of the hub the client is trying to subscribe to.
request IRequest The connect request of the client trying to subscribe to the hub.
리턴 bool

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 IHub.OnConnected method will not be run.
protected OnBeforeConnect ( IHub hub ) : bool
hub IHub The hub the client has connected to.
리턴 bool

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 IHub.OnDisconnected(bool) method will not be run.
protected OnBeforeDisconnect ( IHub hub, bool stopCalled ) : bool
hub IHub The hub the client has disconnected from.
stopCalled bool /// true, if stop was called on the client closing the connection gracefully; /// false, if the client timed out. Timeouts can be caused by clients reconnecting to another SignalR server in scaleout. ///
리턴 bool

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 IHubPipelineModule.BuildIncoming by not executing the invoke parameter or prevented in HubPipelineModule.OnBeforeIncoming by returning false.
protected OnBeforeIncoming ( IHubIncomingInvokerContext context ) : bool
context IHubIncomingInvokerContext A description of the server-side hub method invocation.
리턴 bool

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 OnBeforeOutgoing ( IHubOutgoingInvokerContext context ) : bool
context IHubOutgoingInvokerContext A description of the client-side hub method invocation.
리턴 bool

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 IHub.OnReconnected method will not be run.
protected OnBeforeReconnect ( IHub hub ) : bool
hub IHub The hub the client has reconnected to.
리턴 bool

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.
protected OnIncomingError ( ExceptionContext exceptionContext, IHubIncomingInvokerContext invokerContext ) : void
exceptionContext ExceptionContext /// Represents the exception that was thrown during the server-side invocation. /// It is possible to change the error or set a result using this context. ///
invokerContext IHubIncomingInvokerContext A description of the server-side hub method invocation.
리턴 void