DH.NRemoting
4.0.2024.1126-beta0219
dotnet add package DH.NRemoting --version 4.0.2024.1126-beta0219
NuGet\Install-Package DH.NRemoting -Version 4.0.2024.1126-beta0219
<PackageReference Include="DH.NRemoting" Version="4.0.2024.1126-beta0219" />
paket add DH.NRemoting --version 4.0.2024.1126-beta0219
#r "nuget: DH.NRemoting, 4.0.2024.1126-beta0219"
// Install DH.NRemoting as a Cake Addin #addin nuget:?package=DH.NRemoting&version=4.0.2024.1126-beta0219&prerelease // Install DH.NRemoting as a Cake Tool #tool nuget:?package=DH.NRemoting&version=4.0.2024.1126-beta0219&prerelease
DH.NRemoting - 协议通信库
协议通信库,包含RPC架构和HTTP架构,提供客户端服务端通信的基础框架,内置SRMP协议实现,并支持实现各种自定义协议。
参考目录:
RPC架构
客户端:ApiClient
服务端:ApiServer
应用客户端:ClientBase
特点:
- 服务端根据Action把请求转发给各个Controller,用法跟WebApi一致。
- 简单高性能,通信报文使用二进制序列化,中间没有任何损耗
- 接口出入参支持灵活的Json序列化(常规接口),同时也支持高效的二进制序列化(图片视频)
- TCP/UDP长会话,支持服务端主动下发消息
- 典型连接数,单机1万TCP长连接,最高400万
- 典型吞吐数,单机10万TPS,最高2266万TPS
- 服务端可寄宿于控制台、Web项目、桌面应用、IoT嵌入式应用
- 支持集群部署横向扩展,每个客户端跟其中一个服务端维持长连接,所有请求落到该服务器
代表性应用(蚂蚁调度AntJob):
- 客户端AntClient继承自ClientBase,通过Tcp/Udp等协议连接服务端ApiServer,进行登录、心跳等操作。
- 客户端使用应用AppId和AppSecret登录,获得令牌,后续无需携带或验证令牌,直到令牌过期重新登录。
HTTP架构
客户端:ApiHttpClient
服务端:ASP.NET WebApi
应用客户端:ClientBase
应用服务端:BaseDeviceController
特点:
- 标准ASP.NET WebApi作为服务端,重用现有技术栈,包括接口测试和集群部署管理。
- 客户端ApiHttpClient是标准HttpClient的进一步封装,支持多服务端地址负载均衡。
- 默认通信使用Json序列化,不适合传输文件、图片和视频等二进制数据。
- 服务端提供BaseController基类,封装了令牌验证等鉴权机制
- 服务端提供BaseDeviceController基类,封装常见的登录、心跳和更新等接口
- 通过WebSocket长连接实现指令下发,心跳保活
- 典型连接数,单机1000并发连接
- 典型吞吐数,单机1万TPS
- 服务端仅寄宿于 Kestrel和IIS
- 支持集群部署横向扩展,客户端每次请求都可能分流到不同应用服务器
代表性应用(轻量级IoT平台ZeroIoT):
- 客户端HttpDevice继承自ClientBase,通过Http/Https协议连接服务端WebApi,进行登录、注销、心跳和更新等操作。
- 客户端使用设备DeviceCode和DeviceSecret登录,获得令牌,后续每次请求头都需要带上令牌。
- 在心跳时检测并维持WebSocket长连接。
各项目默认支持net9.0/netstandard2.1/netstandard2.0/net4.5
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.5
- DH.NCore (>= 4.0.2024.1126-beta0132)
-
.NETFramework 4.6.1
- DH.NCore (>= 4.0.2024.1126-beta0132)
-
.NETStandard 2.0
- DH.NCore (>= 4.0.2024.1126-beta0132)
-
.NETStandard 2.1
- DH.NCore (>= 4.0.2024.1126-beta0132)
-
net5.0
- DH.NCore (>= 4.0.2024.1126-beta0132)
-
net6.0
- DH.NCore (>= 4.0.2024.1126-beta0132)
-
net7.0
- DH.NCore (>= 4.0.2024.1126-beta0132)
-
net8.0
- DH.NCore (>= 4.0.2024.1126-beta0132)
-
net9.0
- DH.NCore (>= 4.0.2024.1126-beta0132)
NuGet packages (5)
Showing the top 5 NuGet packages that depend on DH.NRemoting:
Package | Downloads |
---|---|
DH.NStardust
星尘,分布式服务框架。节点管理,监控中心,配置中心,发布中心,注册中心 |
|
DH.NMQTT
流行的物联网通信协议MQTT,包括客户端、服务端 |
|
DH.NRemoting.Extensions
提供WebApi应用级服务端 |
|
DH.NAntJob
分布式任务调度系统,纯NET打造的重量级大数据实时计算平台,万亿级调度经验积累。 |
|
DH.NMQ
轻量级消息队列,无延迟分发,支持消费组和消息去重,不支持集群部署 |
GitHub repositories
This package is not used by any popular GitHub repositories.
第三代协议通信库,增强RPC,引入主流Http/WebSockt/WebApi应用级封装