// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.md in the project root for license information. using System.Collections.Generic; using System.Threading.Tasks; namespace Microsoft.AspNet.SignalR.Hubs { /// /// Implementations of this interface are responsible for executing operation required to complete various stages /// hub processing such as connecting, reconnecting, disconnecting, invoking server-side hub methods, invoking /// client-side hub methods, authorizing hub clients and rejoining hub groups. /// public interface IHubPipelineInvoker { /// /// Invokes a server-side hub method. /// /// A description of the server-side hub method invocation. /// An asynchronous operation giving the return value of the server-side hub method invocation. Task Invoke(IHubIncomingInvokerContext context); /// /// Invokes a client-side hub method. /// /// A description of the client-side hub method invocation. Task Send(IHubOutgoingInvokerContext context); /// /// To be called when a client connects to the for each the client /// connects to. By default, this results in the 's OnConnected method being invoked. /// /// A the client is connected to. Task Connect(IHub hub); /// /// To be called when a client reconnects to the for each the client /// connects to. By default, this results in the 's OnReconnected method being invoked. /// /// A the client is reconnected to. Task Reconnect(IHub hub); /// /// To be called when a client disconnects from the for each the client /// was connected to. By default, this results in the 's OnDisconnected method being invoked. /// /// A the client was disconnected from. Task Disconnect(IHub hub); /// /// To be called before a client subscribes to signals belonging to the hub described by the . /// By default, the will look for attributes on the to help determine if /// the client is authorized to subscribe to method invocations for the described hub. /// /// A description of the hub the client is attempting to connect to. /// /// The connect request being made by the client which should include the client's /// User. /// /// true, if the client is authorized to subscribe to client-side hub method invocations; false, otherwise. bool AuthorizeConnect(HubDescriptor hubDescriptor, IRequest request); /// /// This method determines which of the groups belonging to the hub described by the 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. /// /// A description of the hub for which the client is attempting to rejoin groups. /// The reconnect request being made by the client that is attempting to rejoin groups. /// /// The list of groups belonging to the relevant hub that the client claims to have been a member of before the reconnect. /// /// A list of groups the client is allowed to rejoin. IList RejoiningGroups(HubDescriptor hubDescriptor, IRequest request, IList groups); } }