这是基于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.
 
 
 
 
 
 
colin 3936107340 upgrade: upgrade abp to 10.0.2 2 months ago
..
LINGYUN/Abp/Notifications/SignalR feat(notifications): Add notification push log recording 5 months ago
FodyWeavers.xml upgrade(abp): upgrade abp framework to 7.4.0 2 years ago
FodyWeavers.xsd upgrade(abp): upgrade abp framework to 7.4.0 2 years ago
LINGYUN.Abp.Notifications.SignalR.csproj upgrade: upgrade abp to 10.0.2 2 months ago
README.EN.md feat(docs): 添加实时通知模块文档 1 year ago
README.md feat(docs): 添加实时通知模块文档 1 year ago

README.md

LINGYUN.Abp.Notifications.SignalR

通知系统的SignalR模块,提供了基于SignalR的实时通知功能。

功能特性

  • 实时通知推送
  • 通知Hub实现
  • 客户端连接管理
  • 支持分组通知
  • 支持用户在线状态管理

模块引用

[DependsOn(typeof(AbpNotificationsSignalRModule))]
public class YouProjectModule : AbpModule
{
  // other
}

配置项

{
  "SignalR": {
    "HubUrl": "/signalr-hubs/notifications",
    "UseMessagePack": false
  }
}

Hub定义

NotificationHub

  • SubscribeToNotifications - 订阅通知
  • UnsubscribeFromNotifications - 取消订阅通知
  • GetNotifications - 获取通知列表
  • MarkNotificationAsRead - 标记通知为已读
  • MarkAllNotificationsAsRead - 标记所有通知为已读

基本用法

  1. 服务端配置
public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddSignalR()
                .AddMessagePackProtocol(); // 可选,使用MessagePack协议
    }

    public void Configure(IApplicationBuilder app)
    {
        app.UseEndpoints(endpoints =>
        {
            endpoints.MapHub<NotificationHub>("/signalr-hubs/notifications");
        });
    }
}
  1. 客户端使用
// 连接到通知Hub
const connection = new signalR.HubConnectionBuilder()
    .withUrl("/signalr-hubs/notifications")
    .build();

// 监听通知
connection.on("ReceiveNotification", (notification) => {
    console.log("收到新通知:", notification);
});

// 启动连接
await connection.start();

// 订阅通知
await connection.invoke("SubscribeToNotifications");

更多信息