// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.md in the project root for license information.
using System.Threading.Tasks;
using Microsoft.AspNet.SignalR.Hubs;
namespace Microsoft.AspNet.SignalR
{
///
/// Provides methods that communicate with SignalR connections that connected to a .
///
public abstract class Hub : IHub
{
protected Hub()
{
Clients = new HubConnectionContext();
Clients.All = new NullClientProxy();
Clients.Others = new NullClientProxy();
Clients.Caller = new NullClientProxy();
}
///
///
///
public HubConnectionContext Clients { get; set; }
///
/// Provides information about the calling client.
///
public HubCallerContext Context { get; set; }
///
/// The group manager for this hub instance.
///
public IGroupManager Groups { get; set; }
///
/// Called when a connection disconnects from this hub instance.
///
/// A
public virtual Task OnDisconnected()
{
return TaskAsyncHelper.Empty;
}
///
/// Called when the connection connects to this hub instance.
///
/// A
public virtual Task OnConnected()
{
return TaskAsyncHelper.Empty;
}
///
/// Called when the connection reconnects to this hub instance.
///
/// A
public virtual Task OnReconnected()
{
return TaskAsyncHelper.Empty;
}
protected virtual void Dispose(bool disposing)
{
}
public void Dispose()
{
Dispose(true);
}
}
}