Skip to content

Commit 55632a6

Browse files
author
moozzyk
committed
WeAreSorryHubBase - bringing HubBase back to fix binary compatibility
Fixes SignalR#3489
1 parent 43d72ba commit 55632a6

File tree

3 files changed

+91
-60
lines changed

3 files changed

+91
-60
lines changed

src/Microsoft.AspNet.SignalR.Core/Hub.cs

Lines changed: 10 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -8,68 +8,18 @@ namespace Microsoft.AspNet.SignalR
88
/// <summary>
99
/// Provides methods that communicate with SignalR connections that connected to a <see cref="Hub"/>.
1010
/// </summary>
11-
public abstract class Hub : IHub
11+
public abstract class Hub : HubBase
1212
{
13-
protected Hub()
13+
public IHubCallerConnectionContext<dynamic> Clients
1414
{
15-
Clients = new HubConnectionContext();
16-
}
17-
18-
/// <summary>
19-
/// Gets a dynamic object that represents all clients connected to this hub (not hub instance).
20-
/// </summary>
21-
public IHubCallerConnectionContext<dynamic> Clients { get; set; }
22-
23-
/// <summary>
24-
/// Provides information about the calling client.
25-
/// </summary>
26-
public HubCallerContext Context { get; set; }
27-
28-
/// <summary>
29-
/// The group manager for this hub instance.
30-
/// </summary>
31-
public IGroupManager Groups { get; set; }
32-
33-
/// <summary>
34-
/// Called when a connection disconnects from this hub gracefully or due to a timeout.
35-
/// </summary>
36-
/// <param name="stopCalled">
37-
/// true, if stop was called on the client closing the connection gracefully;
38-
/// false, if the connection has been lost for longer than the
39-
/// <see cref="Configuration.IConfigurationManager.DisconnectTimeout"/>.
40-
/// Timeouts can be caused by clients reconnecting to another SignalR server in scaleout.
41-
/// </param>
42-
/// <returns>A <see cref="Task"/></returns>
43-
public virtual Task OnDisconnected(bool stopCalled)
44-
{
45-
return TaskAsyncHelper.Empty;
46-
}
47-
48-
/// <summary>
49-
/// Called when the connection connects to this hub instance.
50-
/// </summary>
51-
/// <returns>A <see cref="Task"/></returns>
52-
public virtual Task OnConnected()
53-
{
54-
return TaskAsyncHelper.Empty;
55-
}
56-
57-
/// <summary>
58-
/// Called when the connection reconnects to this hub instance.
59-
/// </summary>
60-
/// <returns>A <see cref="Task"/></returns>
61-
public virtual Task OnReconnected()
62-
{
63-
return TaskAsyncHelper.Empty;
64-
}
65-
66-
protected virtual void Dispose(bool disposing)
67-
{
68-
}
69-
70-
public void Dispose()
71-
{
72-
Dispose(true);
15+
get
16+
{
17+
return HubClients;
18+
}
19+
set
20+
{
21+
HubClients = value;
22+
}
7323
}
7424
}
7525
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.md in the project root for license information.
2+
3+
using System.Threading.Tasks;
4+
5+
namespace Microsoft.AspNet.SignalR.Hubs
6+
{
7+
/// <summary>
8+
/// Provides methods that communicate with SignalR connections that connected to a <see cref="Hub"/>.
9+
/// </summary>
10+
public abstract class HubBase : IHub
11+
{
12+
protected HubBase()
13+
{
14+
HubClients = new HubConnectionContext();
15+
}
16+
17+
internal IHubCallerConnectionContext<dynamic> HubClients { get; set; }
18+
19+
/// <summary>
20+
/// Gets a dynamic object that represents all clients connected to this hub (not hub instance).
21+
/// </summary>
22+
IHubCallerConnectionContext<dynamic> IHub.Clients
23+
{
24+
get { return HubClients; }
25+
set { HubClients = value; }
26+
}
27+
28+
/// <summary>
29+
/// Provides information about the calling client.
30+
/// </summary>
31+
public HubCallerContext Context { get; set; }
32+
33+
/// <summary>
34+
/// The group manager for this hub instance.
35+
/// </summary>
36+
public IGroupManager Groups { get; set; }
37+
38+
/// <summary>
39+
/// Called when a connection disconnects from this hub gracefully or due to a timeout.
40+
/// </summary>
41+
/// <param name="stopCalled">
42+
/// true, if stop was called on the client closing the connection gracefully;
43+
/// false, if the connection has been lost for longer than the
44+
/// <see cref="Configuration.IConfigurationManager.DisconnectTimeout"/>.
45+
/// Timeouts can be caused by clients reconnecting to another SignalR server in scaleout.
46+
/// </param>
47+
/// <returns>A <see cref="Task"/></returns>
48+
public virtual Task OnDisconnected(bool stopCalled)
49+
{
50+
return TaskAsyncHelper.Empty;
51+
}
52+
53+
/// <summary>
54+
/// Called when the connection connects to this hub instance.
55+
/// </summary>
56+
/// <returns>A <see cref="Task"/></returns>
57+
public virtual Task OnConnected()
58+
{
59+
return TaskAsyncHelper.Empty;
60+
}
61+
62+
/// <summary>
63+
/// Called when the connection reconnects to this hub instance.
64+
/// </summary>
65+
/// <returns>A <see cref="Task"/></returns>
66+
public virtual Task OnReconnected()
67+
{
68+
return TaskAsyncHelper.Empty;
69+
}
70+
71+
protected virtual void Dispose(bool disposing)
72+
{
73+
}
74+
75+
public void Dispose()
76+
{
77+
Dispose(true);
78+
}
79+
}
80+
}

src/Microsoft.AspNet.SignalR.Core/Microsoft.AspNet.SignalR.Core.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
<Compile Include="ConnectionConfiguration.cs" />
7575
<Compile Include="Hosting\INameValueCollection.cs" />
7676
<Compile Include="Hosting\IResponse.cs" />
77+
<Compile Include="Hubs\HubBase.cs" />
7778
<Compile Include="Hubs\HubInvocationProgress.cs" />
7879
<Compile Include="Hubs\CallerStateProxy.cs" />
7980
<Compile Include="Hubs\TypedHubCallerConnectionContext.cs" />

0 commit comments

Comments
 (0)