Update: SignalR AddToGroups at Query String
Use OnConnection query string to add group membership rather than making an additional call after connection.
This commit is contained in:
@@ -22,6 +22,22 @@ namespace Disco.BI.Interop.SignalRHandlers
|
||||
}
|
||||
}
|
||||
|
||||
protected override Task OnConnected(IRequest request, string connectionId)
|
||||
{
|
||||
string addToGroups = request.QueryString["addToGroups"];
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(addToGroups))
|
||||
{
|
||||
var groups = addToGroups.Split(',');
|
||||
foreach (var g in groups)
|
||||
{
|
||||
this.Groups.Add(connectionId, g);
|
||||
}
|
||||
}
|
||||
|
||||
return base.OnConnected(request, connectionId);
|
||||
}
|
||||
|
||||
protected override System.Threading.Tasks.Task OnReceived(IRequest request, string connectionId, string data)
|
||||
{
|
||||
// Add to Group
|
||||
|
||||
@@ -15,6 +15,22 @@ namespace Disco.BI.Interop.SignalRHandlers
|
||||
RepositoryMonitor.StreamAfterCommit.Subscribe(AfterCommit);
|
||||
}
|
||||
|
||||
protected override Task OnConnected(IRequest request, string connectionId)
|
||||
{
|
||||
string addToGroups = request.QueryString["addToGroups"];
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(addToGroups))
|
||||
{
|
||||
var groups = addToGroups.Split(',');
|
||||
foreach (var g in groups)
|
||||
{
|
||||
this.Groups.Add(connectionId, g);
|
||||
}
|
||||
}
|
||||
|
||||
return base.OnConnected(request, connectionId);
|
||||
}
|
||||
|
||||
protected override Task OnReceived(IRequest request, string connectionId, string data)
|
||||
{
|
||||
// Add to Group
|
||||
|
||||
@@ -21,6 +21,22 @@ namespace Disco.BI.Interop.SignalRHandlers
|
||||
}
|
||||
}
|
||||
|
||||
protected override Task OnConnected(IRequest request, string connectionId)
|
||||
{
|
||||
string addToGroups = request.QueryString["addToGroups"];
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(addToGroups))
|
||||
{
|
||||
var groups = addToGroups.Split(',');
|
||||
foreach (var g in groups)
|
||||
{
|
||||
this.Groups.Add(connectionId, g);
|
||||
}
|
||||
}
|
||||
|
||||
return base.OnConnected(request, connectionId);
|
||||
}
|
||||
|
||||
protected override System.Threading.Tasks.Task OnReceived(IRequest request, string connectionId, string data)
|
||||
{
|
||||
// Add to Group
|
||||
|
||||
Reference in New Issue
Block a user