Update: SignalR 2.0.3 Migration; Noticeboards

Migrate all SignalR 1.x Persistent Connections to SignalR 2.x Hubs.
Abstracts ScheduledTaskStatus with core interface and adds a Mock for
optional status reporting. Noticeboards rewritten (with new theme) to be
more resilient and accurate.
This commit is contained in:
Gary Sharp
2014-06-01 23:27:07 +10:00
parent f6fae26bc7
commit 4cd57f4a90
116 changed files with 9874 additions and 6462 deletions
@@ -0,0 +1,40 @@
using Microsoft.AspNet.SignalR;
using Microsoft.AspNet.SignalR.Hubs;
using System;
using System.Threading.Tasks;
namespace Disco.Services.Jobs.Noticeboards
{
[HubName("noticeboardUpdates")] // Public
public class NoticeboardUpdatesHub : Hub
{
public static IHubContext HubContext { get; private set; }
static NoticeboardUpdatesHub()
{
HubContext = GlobalHost.ConnectionManager.GetHubContext<NoticeboardUpdatesHub>();
}
public override Task OnConnected()
{
var noticeboardId = Context.QueryString["Noticeboard"];
if (string.IsNullOrWhiteSpace(noticeboardId))
throw new ArgumentNullException("Noticeboard");
switch (noticeboardId)
{
case HeldDevicesForUsers.Name:
Groups.Add(Context.ConnectionId, HeldDevicesForUsers.Name);
break;
case HeldDevices.Name:
Groups.Add(Context.ConnectionId, HeldDevices.Name);
break;
default:
throw new ArgumentException("Invalid Noticeboard Specified", "Noticeboard");
}
return base.OnConnected();
}
}
}