C# Класс Microsoft.AspNetCore.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
Показать файл Открыть проект

Открытые методы

Метод Описание
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, HttpRequest 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, HttpRequest request ) : bool
hubDescriptor HubDescriptor A description of the hub the client is trying to subscribe to.
request HttpRequest The connect request made by 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