NewLife.Remoting
4.0.2026.1024
dotnet add package NewLife.Remoting --version 4.0.2026.1024
NuGet\Install-Package NewLife.Remoting -Version 4.0.2026.1024
<PackageReference Include="NewLife.Remoting" Version="4.0.2026.1024" />
<PackageVersion Include="NewLife.Remoting" Version="4.0.2026.1024" />
<PackageReference Include="NewLife.Remoting" />
paket add NewLife.Remoting --version 4.0.2026.1024
#r "nuget: NewLife.Remoting, 4.0.2026.1024"
#:package NewLife.Remoting@4.0.2026.1024
#addin nuget:?package=NewLife.Remoting&version=4.0.2026.1024
#tool nuget:?package=NewLife.Remoting&version=4.0.2026.1024
NewLife.Remoting — Unified Remoting Framework (RPC + HTTP + WebSocket + SRMP)
🌐 简体中文 | 繁體中文 | Español | Deutsch | 日本語 | Français | Português | Русский | 한국어 | العربية
NewLife.Remoting is the unified remoting infrastructure of the NewLife stack, shipped as two NuGet packages:
| Package | Role | Coverage |
|---|---|---|
| NewLife.Remoting | Core communication library | RPC client/server, protocol codecs, connection management, streaming calls, client base classes, command dispatch pipeline, auto-update |
| NewLife.Remoting.Extensions | Extension library | Server controller base classes, minimal API host, device management services, token authentication, command response bus |
Source: https://github.com/NewLifeX/NewLife.Remoting
NuGet:
NewLife.Remoting/NewLife.Remoting.Extensions
Documentation Index
| Document | Description |
|---|---|
| Doc/需求文档.md | Requirements: vision, core goals, functional requirements (RPC/STRM/CLNT/UPGD/SRV/CMD/AOT/L10N/EXT) |
| Doc/架构设计.md | Architecture: layering, core module design, memory management, test strategy, design decisions |
| Doc/SRV-服务端架构.md | Server business architecture: service layer, core flows (login/register/logout/heartbeat/upgrade/event upload/command push), online session lifecycle, cluster deployment |
| Doc/功能清单.md | Feature tracking: status, in-progress items and backlog (release TODOs / pending fixes) |
| Doc/竞品分析.md | Competitive analysis: RPC framework comparison + IoT command push matrix |
| Doc/SRMP.MD | SRMP protocol specification |
| Doc/RPC内存管理设计.md | Zero-copy memory management |
| Doc/自动更新机制.md | End-to-end auto-update design |
| Doc/重试策略.md | Retry policy: IRetryPolicy and exponential backoff samples |
| Doc/AOT兼容性分析.md | NativeAOT support scope, 23 verified scenarios (smoke 23/23), downstream guidance and known limits |
| Doc/多语言本地化接入.md | English runtime messages, Locales/*.yml tables and L.T integration guide |
| Doc/README多语言规范.md | Ordering rules, generator scripts and CI gate for the 11 README languages |
Highlights
| Capability | Description |
|---|---|
| RPC core | SRMP protocol, JSON/binary codecs, request pipeline, client/server, cluster connection management, metadata propagation, retry policy, fully asynchronous server path, TraceId call-chain tracing |
| STRM streaming | Server streaming: IAsyncEnumerable<T> pushed item by item over SRMP and SSE |
| CLNT client base | Login/heartbeat/upgrade/command/event in one place, automatic WS/SSE channel switching |
| UPGD auto-update | Detect → download → verify → extract → overwrite → restart |
| SRV server base | ApiController/BaseController/BaseDeviceController, TokenService, IDeviceService; the same endpoint protocol has both MVC and minimal API hosts (mirrored implementations locked by tests) |
| CMD command push | SessionManager + event bus broadcast + WS/SSE/Ping channels |
| L10N localization | Runtime messages use English as the source text; Locales/*.yml ship 31 built-in languages (including Simplified and Traditional Chinese), missing entries fall back to English; no ResourceManager or satellite assemblies |
| AOT support | Always-on AOT analysis for net8.0+ (0 warnings in the core library and Extensions) + in-house source generator (action dispatch table, stream pumps, signature type preservation); NativeAOT verified for 23 core scenarios, 11 minimal-API host scenarios and 6 XCode device-service scenarios (see AOT doc §8) |
Quick Start
Five lines on the server, five on the client, and RPC works:
// === Server ===
var server = new ApiServer(12345);
server.Register<MyController>();
server.Start();
public class MyController : ApiController
{
public String Ping(String name) => $"Hello {name}, {DateTime.Now:HH:mm:ss}";
// Streaming: returning IAsyncEnumerable<T> pushes items one by one
public async IAsyncEnumerable<String> StreamLogs(Int32 count)
{
for (var i = 0; i < count; i++)
{
await Task.Delay(100);
yield return $"Log #{i}: {DateTime.Now:HH:mm:ss}";
}
}
}
// === Client ===
var client = new ApiClient("tcp://127.0.0.1:12345");
client.Open();
// Regular call
var rs = await client.InvokeAsync<String>("My/Ping", new { name = "dev" });
// Streaming call — receive server pushes one by one
await foreach (var log in client.InvokeStreamAsync<String>("My/StreamLogs", new { count = 10 }))
Console.WriteLine(log);
// Metadata propagation (TraceId is injected automatically)
client.Headers["TenantId"] = "tenant-01";
Performance
| Metric | Typical | Peak in lab |
|---|---|---|
| TCP long connections | 10,000 | 4,000,000 |
| RPC throughput | 100,000 TPS | 455,000 msg/s |
| Single RPC latency | ~41 μs | — |
| Framework support | net45 / net461 / netstandard2.0 / netstandard2.1 / net6.0 / net8.0 / net10.0 (aligned with NewLife.Core v12; NativeAOT on net8.0+) |
Upgrading to v4
v4 aligns with NewLife.Core v12 and changes the network layering. Before upgrading:
- Dual ports: the main port serves SRMP only; set
HttpPortexplicitly to enable HTTP (disabled by default). - No SRMP over WebSocket:
ws:///wss://addresses now throwNotSupportedException; usetcp:///udp://for SRMP andhttp(s)://for HTTP calls. - Codec types removed:
WsClient,HttpCodec,WebSocketClientCodec,WebSocketServerCodecand theHttpMessageframe methods are gone; HTTP is handled by CoreHttpServer, and custom framing should implementIMessageCodec. - English message keys: runtime messages use English source text as locale keys; match
ApiCodeor error codes instead of localized text. - Target frameworks: net5.0/net7.0/net9.0 assets are no longer shipped; NuGet automatically falls back to the nearest supported framework.
See ChangeLog.md for the complete list.
Working with Other NewLife Components
| Component | Value |
|---|---|
| NewLife.Core | Logging, configuration, serialization, localization, object pooling, TimerX, performance tracing |
| NewLife.Net | High-performance network stack, WebSocket/codecs, port reuse |
| NewLife.Redis | Distributed cache / message queue for shared sessions or push fan-out |
| Stardust | Node registration, config center, APM, release center; can host ApiServer nodes |
| AntJob | Job scheduling and distributed computing via ClientBase |
| NewLife.MQTT / Modbus / IoT | Collect device protocols and report upstream through Remoting |
Contributing and Feedback
Contributions welcome: bug reports, performance PRs, new protocol codecs, controller samples, documentation and new translations. When opening an issue, please include: runtime environment, target framework, minimal repro and log excerpt.
Ecosystem Map
NewLife is a layered ecosystem of independently versioned open-source projects. The map below is shared verbatim by every NewLife repository; each project links to its repository and its primary NuGet package.
| Project | What it does | Downloads |
|---|---|---|
| Foundation | ||
| NewLife.Core | Logging, configuration, caching, networking, serialization, scheduling and APM tracing. | |
| NewLife.XCode | Data middleware: single tables at the tens-of-billions scale, automatic sharding, read-write splitting, 10+ databases. | |
| NewLife.Net | High-performance network library: 1.77M pps / 14.5 Gbps on a single machine (TCP 1KB, 2026-10), 4M long-lived TCP connections. | |
| NewLife.Remoting | Protocol communication and RPC framework for client/server applications and IoT devices. | |
| NewLife.Agent | Installs .NET applications as OS daemons: Windows services and Linux systemd. | |
| NewLife.Templates | dotnet new project templates for console, web, API, service, data and IoT projects. |
|
| Data & Messaging | ||
| NewLife.Redis | Redis client with microsecond latency, millions of ops/s and built-in message queues. | |
| NewLife.RocketMQ | Pure managed RocketMQ client for Apache RocketMQ and Alibaba Cloud Message Queue. | |
| NewLife.MQTT | MQTT client and server, including Alibaba Cloud IoT connectivity. | |
| NewLife.NovaDb | Hybrid database in C#: embedded or networked, relational, time-series, message queue and KV in one. | |
| NewLife.MySql | MySql driver and helper layer built on the NewLife data stack. | |
| Web, AI & Distributed | ||
| NewLife.Cube | Rapid admin-platform framework: permissions, SSO, OAuth server and CRUD scaffolding. | |
| Stardust | Distributed service platform: node management, APM, configuration center, registry and release center. | |
| AntJob | Distributed task and real-time data scheduling platform with sharding, retries and backfill. | |
| NewLife.AI | Unified client for 46 LLM providers plus ChatAI, a ready-to-run web chat application. | |
| Industrial & IoT | ||
| NewLife.IoT | IoT standard library defining protocol contracts and device abstractions. | |
| NewLife.Modbus | Modbus TCP/RTU/ASCII implementation on top of NewLife.IoT. | |
| NewLife.Siemens | Siemens PLC protocol on top of NewLife.IoT. | |
| NewLife.Omron | Omron PLC protocol on top of NewLife.IoT. | |
| NewLife.Melsec | Mitsubishi Melsec PLC protocol on top of NewLife.IoT. | |
| NewLife.OPC | OPC client for industrial data access. | — |
| NewLife.BACnet | BACnet building-automation protocol stack. | |
| ZeroIoT | Lightweight open-source IoT platform with gateway and device management. | — |
| Vehicle Telematics | ||
| NewLife.JT808 | JT/T 808 vehicle positioning protocol: 70+ message bodies, 2011/2013/2019. | |
| NewLife.JT809 | JT/T 809 platform-to-platform protocol for transport authorities. | |
| NewLife.JT1078 | JT/T 1078 in-vehicle video: RTP parsing, FLV/fMP4 remuxing and live streaming. | |
| Domain Components | ||
| NewLife.Office | One package for Excel, Word, PPT, PDF and 15+ document formats. | |
| NewLife.Audio | Cross-platform audio: codecs, device I/O, DSP, containers and streaming. | |
| NewLife.Video | Video codecs, container formats, frame processing and streaming. | |
| NewLife.Map | Unified interface over Baidu, AMap, Tencent and Tianditu with geocoding and coordinate conversion. | |
| NewLife.IP | IPv4 geolocation with an offline memory-mapped database and an online API fallback. | |
| Tools & Products | ||
| CrazyCoder | Developer toolbox: network, serial port, crypto, regex, Modbus and MQTT. | |
| GitCandy | Self-hosted Git source code management system. | — |
| LuckyClover | Installs the matching .NET runtime automatically when launched from an older host. | — |
Badges show the primary package of each project; theme, extension and satellite packages are listed on their NuGet pages. The 30+ packages not listed here (FTP, LoRa, Office extensions, protocol drivers and more) are available under the NewLifeX organization and on newlifex.com.
Team
<img src="https://newlifex.com/logo.png" width="48" align="right" alt="NewLife" />
Founded in 2002, the NewLife team has spent more than two decades on the .NET and IoT ecosystem, maintains nearly 100 open-source projects (34 of them core to this map), and delivers integrated software and hardware solutions for power, logistics, healthcare, industrial control and internet industries. We live by the motto "learning has no seniority — mastery earns respect".
Open-source components have been downloaded 6.48M times from NuGet (ecosystem-wide, as of 2026-10).
Website: https://newlifex.com · Open source organization: https://github.com/NewLifeX
<details> <summary>WeChat Official Account: 智能大石头 (scan to follow)</summary>
</details>
License
MIT © NewLife. Commercial use and secondary development are welcome.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. 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 was computed. 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 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. 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. |
| .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
- NewLife.Core (>= 12.0.2026.1024)
-
.NETFramework 4.6.1
- NewLife.Core (>= 12.0.2026.1024)
-
.NETStandard 2.0
- NewLife.Core (>= 12.0.2026.1024)
-
.NETStandard 2.1
- NewLife.Core (>= 12.0.2026.1024)
-
net10.0
- NewLife.Core (>= 12.0.2026.1024)
-
net6.0
- NewLife.Core (>= 12.0.2026.1024)
-
net8.0
- NewLife.Core (>= 12.0.2026.1024)
NuGet packages (8)
Showing the top 5 NuGet packages that depend on NewLife.Remoting:
| Package | Downloads |
|---|---|
|
NewLife.Stardust
星尘分布式服务框架核心库。提供配置中心、注册中心、服务发现、全链路追踪、APM性能监控、日志中心等客户端SDK,支持配置拉取、服务注册与发现、调用追踪、性能和日志上报。 Stardust distributed service framework core library. Provides client SDKs for configuration center, registry, service discovery, distributed tracing, APM, and log center, supporting configuration pulling, service registration and discovery, call tracing, performance and log reporting. |
|
|
NewLife.Cube.Core
魔方MVC/Razor兼容层,支持ASP.NET Core MVC传统开发模式。提供用户权限管理、Razor视图模板、SSO登录、OAuth服务端、数据导出等功能,单表100亿级数据验证。 |
|
|
NewLife.Cube
魔方WebAPI核心库,提供实体控制器、权限管理、菜单管理、字段元数据、OAuth服务端、JWT认证等功能。支持前后端分离架构,对接Vue/Blazor/Antd等前端框架,单表100亿级数据验证。 |
|
|
NewLife.Net
高性能网络通信框架,支持SRMP协议、单机千万级吞吐、百万级连接。提供NetServer/NetClient等通讯组件,可用于构建高可靠网络服务。 |
|
|
NewLife.AntJob
AntJob 分布式任务调度系统核心 SDK,提供高吞吐量的任务切片、可靠重试与弹性伸缩能力。 |
GitHub repositories (7)
Showing the top 7 popular GitHub repositories that depend on NewLife.Remoting:
| Repository | Stars |
|---|---|
|
NewLifeX/X
Core basic components: log (file / network), configuration (XML / JSON / HTTP), cache (memory / redis), network (TCP / UDP / HTTP), RPC framework, serialization (binary / XML / JSON), APM performance tracking. 核心基础组件,日志(文件/网络)、配置(XML/Json/Http)、缓存(内存/Redis)、网络(Tcp/Udp/Http)、RPC框架、序列化(Binary/XML/Json)、APM性能追踪。
|
|
|
NewLifeX/AntJob
高吞吐 .NET 分布式任务与实时数据调度平台:时间/数据/消息/Cron/SQL/脚本切片,自动重试与弹性扩缩,回溯补算 + Web 控制台。High‑throughput .NET distributed job & real‑time scheduler with fine‑grained slicing, retries, elastic scaling & web console.
|
|
|
NewLifeX/Stardust
星尘,轻量级分布式服务框架。配置中心、集群管理、远程自动发布、服务治理。服务自动注册和发现,负载均衡,动态伸缩,故障转移,性能监控。
|
|
|
NewLifeX/XCoder
新生命码神工具,代码生成、网络工具、API工具、串口工具、正则工具、图标工具、加解密工具、地图接口。
|
|
|
NewLifeX/NewLife.Net
单机吞吐2266万tps的网络通信框架
|
|
|
NewLifeX/NewLife.MQTT
最流行的物联网通信协议MQTT,包括客户端、服务端和Web管理平台
|
|
|
NewLifeX/NewLife.XCode
20 年演进的 .NET 高性能数据中间件,聚焦极致性能、海量数据、自动建模/迁移、多级缓存、自动分表分库,支持 MySQL/SQLite/SqlServer/Oracle/Postgresql/达梦 等
|
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.2026.1024 | 256 | 10/24/2026 |
| 4.0.2026.1024-beta0457 | 45 | 10/24/2026 |
| 3.9.2026.1022-beta0147 | 52 | 10/22/2026 |
| 3.9.2026.1021-beta0410 | 172 | 10/21/2026 |
| 3.9.2026.1019-beta1013 | 479 | 10/19/2026 |
| 3.9.2026.1019-beta0326 | 100 | 10/19/2026 |
| 3.9.2026.1019-beta0215 | 103 | 10/19/2026 |
| 3.9.2026.1017-beta1444 | 551 | 10/17/2026 |
| 3.9.2026.1016-beta0206 | 815 | 10/16/2026 |
| 3.9.2026.1015-beta1355 | 532 | 10/15/2026 |
| 3.9.2026.1009-beta1312 | 111 | 10/9/2026 |
| 3.9.2026.901 | 1,471 | 9/1/2026 |
| 3.9.2026.901-beta0431 | 139 | 9/1/2026 |
| 3.9.2026.801 | 2,026 | 8/1/2026 |
| 3.9.2026.801-beta1701 | 166 | 8/1/2026 |
| 3.8.2026.726-beta1405 | 236 | 7/26/2026 |
| 3.8.2026.723-beta1615 | 162 | 7/23/2026 |
| 3.8.2026.722-beta1157 | 152 | 7/22/2026 |
| 3.8.2026.720-beta1503 | 152 | 7/20/2026 |
| 3.8.2026.716-beta0416 | 682 | 7/16/2026 |
v4 大版本:对齐 NewLife.Core v12 网络层,主端口仅跑 SRMP、HTTP 需显式 HttpPort,移除 ws:// 承载 SRMP 与自研 HTTP/WS 帧栈;支持 NativeAOT 并内置源生成器,动作静态表消除路由反射;新增令牌吊销与访问/刷新令牌分离,GetUserHost 支持可信代理防伪造;Extensions 新增最小 API 端点宿主;运行时词表扩展至 31 种语言;升级 NewLife.Core 12.0.2026.1024