feat: 添加SignalR登录状态管理功能

- 在Program.cs中注册LoginHub
- 在HomeController中传递用户ID以支持SignalR连接
- 在Index.cshtml中实现SignalR连接和心跳机制,处理强制登出和注册成功事件
- 移除旧的登录状态检查逻辑,优化页面加载时的连接管理
This commit is contained in:
zhougf committed 2025-12-05 21:36:47 +08:00
1 parent 0e5d0247bf
commit c38199268f
9 files changed
+242 -49

No files matched your search

+1
View File
@@ -103,6 +103,7 @@ app.UseEndpoints(endpoints =>
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
endpoints.MapHub<StockTickerHub>("/stocks");
endpoints.MapHub<LoginHub>("/loginHub");
});
// 添加以下代码以确保响应是UTF-8编码
app.Use(async (context, next) =>