fix: align backend APIs and upload flow
This commit is contained in:
@@ -10,11 +10,13 @@ namespace ConnectorService.Hubs
|
||||
{
|
||||
private readonly IConversationIntergrationService conService;
|
||||
private readonly StackExchange.Redis.IDatabase redis;
|
||||
private readonly ConnectionRegistry registry;
|
||||
|
||||
public ChatHub(IConversationIntergrationService conService, IConnectionMultiplexer multiplexer)
|
||||
public ChatHub(IConversationIntergrationService conService, IConnectionMultiplexer multiplexer, ConnectionRegistry registry)
|
||||
{
|
||||
this.conService = conService;
|
||||
this.redis = multiplexer.GetDatabase();
|
||||
this.registry = registry;
|
||||
}
|
||||
|
||||
public async override Task OnConnectedAsync()
|
||||
@@ -34,6 +36,7 @@ namespace ConnectorService.Hubs
|
||||
}
|
||||
|
||||
await redis.SetAddAsync(RedisHelper.GetConnectionIdKey(userId), Context.ConnectionId);
|
||||
await registry.Add(Context);
|
||||
|
||||
|
||||
await base.OnConnectedAsync();
|
||||
@@ -41,6 +44,7 @@ namespace ConnectorService.Hubs
|
||||
|
||||
public async override Task OnDisconnectedAsync(Exception? exception)
|
||||
{
|
||||
await registry.Remove(Context);
|
||||
if (Context.User.Identity.IsAuthenticated)
|
||||
{
|
||||
var userId = Context.User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
|
||||
Reference in New Issue
Block a user