NewLife.Remoting
Unified RPC, HTTP, WebSocket and SRMP communication for client-server and IoT applications. 提供 RPC、HTTP、WebSocket 与 SRMP 统一通信能力。
Install
| Product | Versions |
|---|---|
| .NET | |
| .NET Standard | |
| Other |
README
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+) |
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
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
WeChat Official Account: 智能大石头 (scan to follow)

License
MIT © NewLife. Commercial use and secondary development are welcome.
Changes from Previous Version
Adoption Assessment
Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.