Skip to content

About

统一高性能远程通信框架:RPC + HTTP/REST + WebSocket + SRMP,支持 net45~net10,海量长连接与高吞吐,统一登录/心跳/指令/事件生命周期,零重依赖。

Topics

Resources

Stars

16 stars

Watchers

12 watching

Forks

Latest commit

 

History

645 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NewLife.Remoting — Unified Remoting Framework (RPC + HTTP + WebSocket + SRMP)

GitHub License NuGet Downloads NuGet NuGet prerelease NuGet Downloads (Extensions) NuGet (Extensions) NuGet prerelease (Extensions) NativeAOT test

AOT smoke TFM locales

platform arch contributors

🌐 简体中文 | 繁體中文 | 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 / net11.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 HttpPort explicitly to enable HTTP (disabled by default).
  • No SRMP over WebSocket: ws:///wss:// addresses now throw NotSupportedException; use tcp:///udp:// for SRMP and http(s):// for HTTP calls.
  • Codec types removed: WsClient, HttpCodec, WebSocketClientCodec, WebSocketServerCodec and the HttpMessage frame methods are gone; HTTP is handled by Core HttpServer, and custom framing should implement IMessageCodec.
  • English message keys: runtime messages use English source text as locale keys; match ApiCode or 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
基础底座
NewLife.Core 日志、配置、缓存、网络、序列化、定时调度与 APM 追踪。 NuGet
NewLife.XCode 数据中间件:单表百亿级、自动分表、读写分离,支持 10 多种数据库。 NuGet
NewLife.Net 高性能网络库:单机 177 万 pps、14.5 Gbps(TCP 1KB,2026-10 实测),400 万 Tcp 长连接。 NuGet
NewLife.Remoting 协议通信与 RPC 框架,面向 CS 应用与物联网设备。 NuGet
NewLife.Agent 把 .NET 应用安装为操作系统守护进程:Windows 服务与 Linux systemd。 NuGet
NewLife.Templates dotnet new 项目模板:控制台、Web、WebApi、服务、数据与物联网。 NuGet
数据存储与消息
NewLife.Redis Redis 客户端:微秒级延迟、百万级吞吐,内置消息队列。 NuGet
NewLife.RocketMQ 纯托管 RocketMQ 客户端,支持 Apache RocketMQ 与阿里云消息队列。 NuGet
NewLife.MQTT MQTT 客户端与服务端,客户端支持阿里云物联网。 NuGet
NewLife.NovaDb C# 混合数据库:嵌入/网络双模,关系型、时序、消息队列与 KV 于一体。 NuGet
NewLife.MySql MySql 驱动与数据访问辅助层,基于 NewLife 数据栈实现。 NuGet
NewLife.TDengine 纯托管 TDengine ADO.NET 驱动:REST、WebSocket 与原生 RPC 三种连接方式,零本机依赖。 NuGet
NewLife.Presto 纯 C# Presto/Trino ADO.NET 驱动,零第三方依赖,支持 XCode ORM 集成。 NuGet
Web 与分布式
NewLife.Cube 魔方快速开发平台:用户权限、SSO、OAuth 服务端与 CRUD 脚手架。 NuGet
NewLife.Cube.React 魔方前后端分离示例:WebAPI 后端 + Swagger + React/Vue/Blazor 前端。 NuGet
Stardust 星尘分布式服务平台:节点管理、APM、配置中心、注册中心与发布中心。 NuGet
AntJob 蚂蚁调度:分布式任务与实时数据平台,支持分片、重试与回溯补算。 NuGet
AI 与视觉
NewLife.AI 统一接入 46 家大模型服务商,附带开箱即用的 ChatAI Web 对话应用。 NuGet
NewLife.Imaging 纯托管图像基础库:像素模型、编解码契约、绘制与元数据,零原生依赖。 —
NewLife.Vision 视觉算法库:OCR、条码、目标检测与人脸识别,构建在 NewLife.Imaging 之上。 —
NewLife.ML 面向 .NET 的表格机器学习:把数据库表与 Excel 变成可部署的预测与分类模型。 —
工业与物联网
NewLife.IoT IoT 标准库,定义物联网通信协议契约与设备抽象。 NuGet
NewLife.Modbus Modbus TCP/RTU/ASCII,基于 NewLife.IoT 实现。 NuGet
NewLife.Siemens 西门子 PLC 协议,基于 NewLife.IoT 实现。 NuGet
NewLife.Omron 欧姆龙 PLC 协议,基于 NewLife.IoT 实现。 NuGet
NewLife.Melsec 三菱 Melsec PLC 协议,基于 NewLife.IoT 实现。 NuGet
NewLife.Schneider 施耐德 PLC 通信驱动,基于 Modbus TCP。 NuGet
NewLife.OPC OPC 客户端,用于工业数据采集。 —
NewLife.BACnet BACnet 楼宇自控协议栈。 NuGet
NewLife.LoRa 超低功耗物联网远程通信协议 LoRaWAN。 NuGet
ZeroIoT 开源轻量级 IoT 平台,含网关与设备管理。 —
车联网
NewLife.JT808 JT/T 808 车辆定位协议:70+ 消息体,覆盖 2011/2013/2019 三个版本。 NuGet
NewLife.JT809 JT/T 809 部标平台互联协议,面向运输管理部门。 NuGet
NewLife.JT1078 JT/T 1078 车载视频:RTP 解析、FLV/fMP4 转封装与直播推送。 NuGet
领域组件
NewLife.Office 一个包覆盖 Excel、Word、PPT、PDF 等 15+ 文档格式。 NuGet
NewLife.Audio 跨平台音频:编解码、设备 IO、DSP、容器与流式处理。 NuGet
NewLife.Video 视频编解码、封装格式、帧处理与流媒体。 NuGet
NewLife.Map 百度/高德/腾讯/天地图统一接口,支持地理编码与坐标转换。 NuGet
NewLife.IP IPv4 归属地:离线内存映射库 + 在线 API 双源。 NuGet
NewLife.Holiday 中国假期识别库:内置每年假期与调休数据,支持农历节日,完全离线。 NuGet
工具与产品
CrazyCoder 码神工具:网络、串口、加解密、正则、Modbus 与 MQTT。 NuGet
NewLife.UnitTest 单元测试扩展库:测试基类、数据驱动与依赖注入辅助。 NuGet
GitCandy 自托管 Git 源代码管理系统。 —
LuckyClover 从低版本宿主启动时,自动安装匹配的 .NET 运行时。 —

徽章取各项目主包;主题包、扩展包与卫星包见对应 NuGet 页面。未在表中列出的 30 多个包(FTP、Office 扩展、各类协议驱动等)见 NewLifeX 组织 与 newlifex.com。


Team

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 (44 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.

About

统一高性能远程通信框架:RPC + HTTP/REST + WebSocket + SRMP,支持 net45~net10,海量长连接与高吞吐,统一登录/心跳/指令/事件生命周期,零重依赖。

Topics

Resources

Stars

16 stars

Watchers

12 watching

Forks

Releases

Packages

Used by

Contributors

Languages