Microsoft.AspNetCore.SignalR.Hubs.HubPipelineModule.BuildConnect C# (CSharp) Method

BuildConnect() public method

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.
return Task>.Func
        public virtual Func<IHub, Task> BuildConnect(Func<IHub, Task> connect)
        {
            return hub =>
            {
                if (OnBeforeConnect(hub))
                {
                    return connect(hub).OrEmpty().Then(h => OnAfterConnect(h), hub);
                }

                return TaskAsyncHelper.Empty;
            };
        }