Back to rankings

rpclib/rpclib

C++rpclib.net

rpclib is a modern C++ msgpack-RPC server and client library

rpccpp14cppcpluspluscplusplus-14msgpack
Star Growth
Stars
1.8k
Forks
397
Weekly Growth
Issues
100
5001k1.5k
Dec 2015Jun 2019Jan 2023Jul 2026
README

rpclib MIT Build Status Build status Coverage Status Coverity Gitter

Status

rpclib is looking for maintainers

If you're looking for a similar library with support for JSON-RPC and async operations, check out packio.

Overview

rpclib is a RPC library for C++, providing both a client and server implementation. It is built using modern C++14, and as such, requires a recent compiler. Main highlights:

  • Expose functions of your program to be called via RPC (from any language implementing msgpack-rpc)
  • Call functions through RPC (of programs written in any language)
  • No IDL to learn
  • No code generation step to integrate in your build, just C++

Look&feel

Server

#include <iostream>
#include "rpc/server.h"

void foo() {
    std::cout << "foo was called!" << std::endl;
}

int main(int argc, char *argv[]) {
    // Creating a server that listens on port 8080
    rpc::server srv(8080);

    // Binding the name "foo" to free function foo.
    // note: the signature is automatically captured
    srv.bind("foo", &foo);

    // Binding a lambda function to the name "add".
    srv.bind("add", [](int a, int b) {
        return a + b;
    });

    // Run the server loop.
    srv.run();

    return 0;
}

When srv.run() is called, rpclib starts the server loop which listens to incoming connections and tries to dispatch calls to the bound functions. The functions are called from the thread where run was called from. There is also async_run that spawns worker threads and returns immediately.

Client

#include <iostream>
#include "rpc/client.h"

int main() {
    // Creating a client that connects to the localhost on port 8080
    rpc::client client("127.0.0.1", 8080);

    // Calling a function with paramters and converting the result to int
    auto result = client.call("add", 2, 3).as<int>();
    std::cout << "The result is: " << result << std::endl;
    return 0;
}

Status

All planned 1.0.0 features are done and tested; the current state is production-ready.

Who uses rpclib?

This list is updated as I learn about more people using the library; let me know if you don't want your project listed here.

Thanks

rpclib builds on the efforts of fantastic C++ projects. In no particular order:

Shoutouts to

Related repositories
doocs/advanced-java

😮 Core Interview Questions & Answers For Experienced Java(Backend) Developers | 互联网 Java 工程师进阶知识完全扫盲:涵盖高并发、分布式、高可用、微服务、海量数据处理等领域知识

JavaMavenCreative Commons Attribution Share Alike 4.0 Internationaljavadistributed-systems
java.doocs.org
79k19.2k
protocolbuffers/protobuf

Protocol Buffers - Google's data interchange format

C++Otherprotobufprotocol-buffers
protobuf.dev
71.6k16.2k
meteor/meteor

Meteor, the JavaScript App Platform

JavaScriptnpmOtherjavascriptmeteor
meteor.com
44.8k5.2k
apache/dubbo

The java implementation of Apache Dubbo. An RPC and microservice framework.

JavaMavenApache License 2.0dubbodistributed-systems
dubbo.apache.org
41.5k26.4k
aria2/aria2

aria2 is a lightweight multi-protocol & multi-source, cross platform download utility operated in command-line. It supports HTTP/HTTPS, FTP, SFTP, BitTorrent and Metalink.

C++GNU General Public License v2.0cpp11http
aria2.github.io
41.5k3.9k
zeromicro/go-zero

A cloud-native Go microservices framework with cli tool for productivity.

GoGo ModulesMIT Licensegolangmicroservice
go-zero.dev
33.2k4.3k
google/flatbuffers

FlatBuffers: Memory Efficient Serialization Library

C++Apache License 2.0flatbuffersserialization
flatbuffers.dev
26.2k3.6k
grpc/grpc-go

The Go language implementation of gRPC. HTTP/2 based RPC

GoGo ModulesApache License 2.0gogrpc
grpc.io
23k4.7k
chai2010/advanced-go-programming-book

:books: 《Go语言高级编程》开源图书,涵盖CGO、Go汇编语言、RPC实现、Protobuf插件实现、Web框架实现、分布式系统等高阶主题(完稿)

GoGo ModulesBSD 2-Clause "Simplified" Licensegogolang
chai2010.cn/advanced-go-programming-book/
20.1k3.2k
apache/brpc

brpc is an Industrial-grade RPC framework using C++ Language, which is often used in high performance system such as Search, Storage, Machine learning, Advertisement, Recommendation etc. "brpc" means "better RPC".

C++Apache License 2.0rpc
brpc.apache.org
17.6k4.1k
TanStack/router

🤖 A client-first, server-capable, fully type-safe router and full-stack framework for the web (React and more).

TypeScriptnpmMIT Licensereactrouter
tanstack.com/router
14.8k1.8k
grpc/grpc-rust

A native gRPC client & server implementation with async/await support.

Rustcrates.ioMIT Licenserustgrpc
docs.rs/tonic
12.4k1.2k