You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using Furion.EventBus;
|
|
|
|
|
using Microsoft.AspNetCore.SignalR;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace Myshipping.Core
|
|
|
|
|
{
|
|
|
|
|
public class MessagePushSubscriber : IEventSubscriber
|
|
|
|
|
{
|
|
|
|
|
private readonly IHubContext<ChatHub, IChatClient> _chatHubContext;
|
|
|
|
|
private readonly ILogger<DingTalkSubscriber> _logger;
|
|
|
|
|
|
|
|
|
|
public MessagePushSubscriber(IHubContext<ChatHub, IChatClient> chatHubContext,
|
|
|
|
|
ILogger<DingTalkSubscriber> logger)
|
|
|
|
|
{
|
|
|
|
|
this._chatHubContext = chatHubContext;
|
|
|
|
|
_logger = logger;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[EventSubscribe("Message:NotifyReceiveNew")]
|
|
|
|
|
public async Task NotifyReceiveNew(EventHandlerExecutingContext context)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation($"收到推送接收到新消息的订阅消息");
|
|
|
|
|
await _chatHubContext.Clients.All.NotifyReceiveNewMessage();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|