提交
This commit is contained in:
+29
-29
@@ -1,29 +1,29 @@
|
||||
using IM_API.Domain.Events;
|
||||
using IM_API.Dtos;
|
||||
using IM_API.Hubs;
|
||||
using IM_API.VOs.Group;
|
||||
using MassTransit;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
|
||||
namespace IM_API.Application.EventHandlers.GroupRequestUpdateHandler
|
||||
{
|
||||
public class RequestUpdateSignalrHandler : IConsumer<GroupRequestUpdateEvent>
|
||||
{
|
||||
private readonly IHubContext<ChatHub> _hub;
|
||||
public RequestUpdateSignalrHandler(IHubContext<ChatHub> hub)
|
||||
{
|
||||
_hub = hub;
|
||||
}
|
||||
|
||||
public async Task Consume(ConsumeContext<GroupRequestUpdateEvent> context)
|
||||
{
|
||||
var msg = new HubResponse<GroupRequestUpdateVo>("Event", new GroupRequestUpdateVo
|
||||
{
|
||||
GroupId = context.Message.GroupId,
|
||||
RequestId = context.Message.RequestId,
|
||||
UserId = context.Message.UserId
|
||||
});
|
||||
await _hub.Clients.User(context.Message.UserId.ToString()).SendAsync("ReceiveMessage", msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
using IM_API.Domain.Events;
|
||||
using IM_API.Dtos;
|
||||
using IM_API.Hubs;
|
||||
using IM_API.VOs.Group;
|
||||
using MassTransit;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
|
||||
namespace IM_API.Application.EventHandlers.GroupRequestUpdateHandler
|
||||
{
|
||||
public class RequestUpdateSignalrHandler : IConsumer<GroupRequestUpdateEvent>
|
||||
{
|
||||
private readonly IHubContext<ChatHub> _hub;
|
||||
public RequestUpdateSignalrHandler(IHubContext<ChatHub> hub)
|
||||
{
|
||||
_hub = hub;
|
||||
}
|
||||
|
||||
public async Task Consume(ConsumeContext<GroupRequestUpdateEvent> context)
|
||||
{
|
||||
var msg = new HubResponse<GroupRequestUpdateVo>("Event", new GroupRequestUpdateVo
|
||||
{
|
||||
GroupId = context.Message.GroupId,
|
||||
RequestId = context.Message.RequestId,
|
||||
UserId = context.Message.UserId
|
||||
});
|
||||
await _hub.Clients.User(context.Message.UserId.ToString()).SendAsync("ReceiveMessage", msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user