You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.5 KiB
57 lines
1.5 KiB
9 months ago
|
using Microsoft.AspNet.SignalR;
|
||
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Text;
|
||
|
using System.Threading.Tasks;
|
||
|
|
||
|
namespace Platform.Infrastructure.SignalRLayer.SignalR
|
||
|
{
|
||
|
public class SignalRConnection: PersistentConnection
|
||
|
{
|
||
|
protected override Task OnConnected(IRequest request, string connectionId)
|
||
|
{
|
||
|
string userId = string.Empty;
|
||
|
try
|
||
|
{
|
||
|
userId = request.Cookies["fy_root_cookie"].Value.ToLower();
|
||
|
}
|
||
|
catch (Exception e )
|
||
|
{
|
||
|
|
||
|
}
|
||
|
if (!String.IsNullOrWhiteSpace(userId))
|
||
|
{
|
||
|
Groups.Add(connectionId,userId);
|
||
|
}
|
||
|
return base.OnConnected(request, connectionId);
|
||
|
}
|
||
|
|
||
|
protected override Task OnReceived(IRequest request, string connectionId, string data)
|
||
|
{
|
||
|
return base.OnReceived(request, connectionId, data);
|
||
|
}
|
||
|
|
||
|
protected override Task OnReconnected(IRequest request, string connectionId)
|
||
|
{
|
||
|
string userId = string.Empty;
|
||
|
try
|
||
|
{
|
||
|
userId = request.Cookies[""].Value.ToLower();
|
||
|
}
|
||
|
catch (Exception e)
|
||
|
{
|
||
|
|
||
|
}
|
||
|
if (!String.IsNullOrWhiteSpace(userId))
|
||
|
{
|
||
|
Groups.Add(connectionId, userId);
|
||
|
|
||
|
}
|
||
|
return base.OnReconnected(request, connectionId);
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|