Galosys.Foundation.AspNetCore.SignalR
26.7.31.1
dotnet add package Galosys.Foundation.AspNetCore.SignalR --version 26.7.31.1
NuGet\Install-Package Galosys.Foundation.AspNetCore.SignalR -Version 26.7.31.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Galosys.Foundation.AspNetCore.SignalR" Version="26.7.31.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Galosys.Foundation.AspNetCore.SignalR" Version="26.7.31.1" />
<PackageReference Include="Galosys.Foundation.AspNetCore.SignalR" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Galosys.Foundation.AspNetCore.SignalR --version 26.7.31.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Galosys.Foundation.AspNetCore.SignalR, 26.7.31.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Galosys.Foundation.AspNetCore.SignalR@26.7.31.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Galosys.Foundation.AspNetCore.SignalR&version=26.7.31.1
#tool nuget:?package=Galosys.Foundation.AspNetCore.SignalR&version=26.7.31.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Galosys.Foundation.AspNetCore.SignalR
SignalR 基础设施子包,提供 HubBase、IConnectionManager、自动注册。
安装
<PackageReference Include="Galosys.Foundation.AspNetCore.SignalR" />
功能
- HubBase — SignalR Hub 基类,含按 userId 自动分组
- HubAttribute — Hub 路由标记
- MapHubs() — 自动扫描并映射所有
[Hub]类 - IConnectionManager — userId ↔ connectionId 映射(InMemory 实现)
- SignalRModule — 引用即自动注册
AddSignalR()+IConnectionManager
使用
// HubBase 自动注册,引用即用
// 或手动调用:
services.AddSignalR();
app.MapHubs();
// 获取在线连接
var connections = connectionManager.GetConnections(userId);
await hubContext.Clients.Clients(connections).SendAsync("Notify", message);
部署
多副本 - Redis Backplane
多实例部署时需 Redis backplane 保证跨实例消息广播:
builder.Services.AddSignalR()
.AddStackExchangeRedis(o => {
o.ConfigurationOptions.EndPoints = { "redis:6379" };
o.ConfigurationOptions.DefaultDatabase = 2;
o.Configuration.ChannelPrefix = "Galosys:SignalR:";
});
K8s 粘性会话
SignalR WebSocket 连接必须始终路由到同一 Pod,否则 negotiate 升级会失败:
apiVersion: v1
kind: Service
spec:
sessionAffinity: ClientIP
sessionAffinityConfig:
clientIP:
timeoutSeconds: 10800
Ingress(Nginx)多副本时需两跳粘性:
metadata:
annotations:
nginx.ingress.kubernetes.io/affinity: "cookie"
nginx.ingress.kubernetes.io/session-cookie-name: "route"
nginx.ingress.kubernetes.io/session-cookie-expires: "10800"
bsc-basecenter 模板 dep/k8s/ 下已预设注释版配置,取消注释即可启用。详见模板 README。
WebSocket 限制
- 负载均衡器需允许 WebSocket 升级(
Upgrade: websocket) - 空闲连接超时建议 ≥ 30 分钟
- 反向代理需配置较长的 proxy read timeout(Nginx:
proxy_read_timeout 3600s)
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Galosys.Foundation.Core (>= 26.7.31.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Galosys.Foundation.AspNetCore.SignalR:
| Package | Downloads |
|---|---|
|
Galosys.Foundation.AspNetCore.Notification
Galosys.Foundation快速开发库 |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 26.7.31.1 | 23 | 7/31/2026 |
| 26.7.30.1 | 69 | 7/30/2026 |
| 26.7.29.1 | 79 | 7/29/2026 |
| 26.7.28.1 | 87 | 7/28/2026 |
| 26.7.26.2 | 91 | 7/26/2026 |
| 26.7.26.1 | 94 | 7/25/2026 |
| 26.7.25.1 | 91 | 7/25/2026 |
| 26.7.24.2 | 99 | 7/24/2026 |
| 26.7.24.1 | 94 | 7/24/2026 |
| 26.7.22.1 | 98 | 7/23/2026 |
| 26.7.21.1 | 101 | 7/21/2026 |
| 26.7.20.2 | 97 | 7/20/2026 |
| 26.7.20.1 | 96 | 7/20/2026 |
| 26.7.19.3 | 92 | 7/19/2026 |
| 26.7.19.2 | 90 | 7/19/2026 |
| 26.7.19.1 | 96 | 7/19/2026 |
| 26.7.18.2 | 98 | 7/18/2026 |
| 26.7.18.1 | 93 | 7/18/2026 |
| 26.7.17.1 | 95 | 7/17/2026 |
| 26.7.14.1 | 97 | 7/14/2026 |
Loading failed