百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
D

duplex

> 编程语言
开源

全双工现代 RPC

391 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

全双工现代 RPC

Duplex RPC

Modern full-duplex RPC

  • Serialization and transport agnostic
  • Client and server combined into Peer object
  • Calls and callbacks in either direction
  • Optional streaming of results and arguments
  • Extensible with middleware (soon)
  • Easy to implement protocol and API
  • Ready-to-go implementations
    • Go
    • Python 3
    • JavaScript (Node.js and browser)
    • TODO: Ruby?

Getting Started

  • with Python
  • with Go
  • with JavaScript

Tour

Language and serialization agnostic

Duplex is an RPC protocol designed for dynamic (and some statically-typed) languages that focuses on advanced RPC semantics and not object or frame serialization. This lets you pick how to marshal objects, whether with JSON, msgpack, protobuf, BERT, BSON, or anything custom.

javascript
// rpc setup using json
go
// rpc setup using gob

API combines client and server into "peer"

While that alone is somehow already revolutionary for RPC protocols, it also combines client and server into a peer object, letting either side of the connection call or provide invocable service methods. This means you never have to worry about only having a client or only having a server library in your language. It also allows for flexible connection topologies (server calling client functions), callbacks, and plugin architectures.

python
# server with methods connects to client
javascript
// method gets a callback and calls back to the client

Bi-directional object streaming

Methods can also stream multiple results and accept multiple streaming arguments, letting you use Duplex for bi-directional object streaming. Among other patterns, this lets you implement real-time data synchronization, connection tunneling, and interactive consoles, all with the same mechanism as simple remote method calls.

go
// calls an interactive method, attaches to terminal
ruby
# call to subscribe to updates

Simple, extensible API and protocol

Duplex has a simple protocol spec not much more complex than JSON-RPC. It also has an API guide that can be used for easy and consistent implementations in various languages.

The protocol and API are also designed to eventually be extensible. Expect a middleware mechanism that lets you add tracing, authentication, policy, transactions, and more. This allows Duplex to remain simple but powerful.

Transport agnostic, frame interface

The API design has a simple framed transport interface. This means out of the box you can expect to use any transport that takes care of framing, for example WebSockets, UDP, ZeroMQ, AMQP. Wrapping streaming transports such as raw TCP or STDIO with length-prefix or newline framing lets you use them as well. By focusing on frames and making the API transport agnostic, as well as being serialization agnostic, implementations are very simple with no major dependencies.

TODO

  • document spec / api
  • demo
    • cross language, browser
    • topologies: client-server, server-client, gateway
    • transports: websocket, tcp, UDP
    • codecs: json, msgpack, protobuf
    • streaming: state sync, terminal
    • callbacks: async reply, events, plugins
    • gateway: behind firewall, client to client (browser)
    • patterns: identity, reflection (cli), self docs
    • implementation: code tour, api guide, protocol spec

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Python

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言