这是基于vue-vben-admin 模板适用于abp Vnext的前端管理项目
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.
 
 
 
 
 
 

1.7 KiB

LINGYUN.Abp.RealTime

介绍

LINGYUN.Abp.RealTime 是一个实时通信基础模块,提供了实时消息传递的基础设施。该模块主要用于处理实时通知、消息和事件的传递。

功能

  • 实时事件传递基础设施
  • 支持本地化字符串处理
  • 分布式事件集成
  • 可扩展的事件处理机制

安装

dotnet add package LINGYUN.Abp.RealTime

使用

  1. 添加 [DependsOn(typeof(AbpRealTimeModule))] 到你的模块类上。
[DependsOn(typeof(AbpRealTimeModule))]
public class YourModule : AbpModule
{
    // ...
}
  1. 创建实时事件数据传输对象:
public class YourRealTimeEto : RealTimeEto<YourData>
{
    public YourRealTimeEto(YourData data) 
        : base(data)
    {
    }
}
  1. 使用本地化字符串:
public class LocalizedMessage
{
    private readonly LocalizableStringInfo _localizableString;

    public LocalizedMessage()
    {
        _localizableString = new LocalizableStringInfo(
            "YourResource",
            "MessageKey",
            new Dictionary<object, object>
            {
                { "param1", "value1" }
            });
    }
}

高级用法

1. 自定义实时事件

[EventName("your-custom-event")]
public class CustomRealTimeEto : RealTimeEto<CustomData>
{
    public CustomRealTimeEto(CustomData data) 
        : base(data)
    {
    }
}

2. 实时事件处理

public class YourRealTimeEventHandler : 
    IDistributedEventHandler<YourRealTimeEto>,
    ITransientDependency
{
    public async Task HandleEventAsync(YourRealTimeEto eventData)
    {
        // 处理实时事件
    }
}

链接