{"id":13418631,"url":"https://github.com/rpclib/rpclib","last_synced_at":"2025-04-13T07:22:58.458Z","repository":{"id":37732994,"uuid":"46743840","full_name":"rpclib/rpclib","owner":"rpclib","description":"rpclib is a modern C++ msgpack-RPC server and client library","archived":false,"fork":false,"pushed_at":"2024-04-09T11:29:25.000Z","size":3441,"stargazers_count":1761,"open_issues_count":106,"forks_count":386,"subscribers_count":73,"default_branch":"master","last_synced_at":"2025-04-06T04:02:31.326Z","etag":null,"topics":["cplusplus","cplusplus-14","cpp","cpp14","msgpack","rpc"],"latest_commit_sha":null,"homepage":"http://rpclib.net","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rpclib.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-11-23T19:46:04.000Z","updated_at":"2025-04-03T19:43:14.000Z","dependencies_parsed_at":"2024-05-01T23:11:57.083Z","dependency_job_id":"7ae0fac9-604a-4832-912d-3f23ab6754cd","html_url":"https://github.com/rpclib/rpclib","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rpclib%2Frpclib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rpclib%2Frpclib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rpclib%2Frpclib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rpclib%2Frpclib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rpclib","download_url":"https://codeload.github.com/rpclib/rpclib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248676436,"owners_count":21143918,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cplusplus","cplusplus-14","cpp","cpp14","msgpack","rpc"],"created_at":"2024-07-30T22:01:04.721Z","updated_at":"2025-04-13T07:22:58.415Z","avatar_url":"https://github.com/rpclib.png","language":"C++","readme":"# rpclib ![MIT](https://img.shields.io/badge/license-MIT-blue.svg) [![Build Status](https://travis-ci.org/rpclib/rpclib.svg?branch=master)](https://travis-ci.org/rpclib/rpclib) [![Build status](https://ci.appveyor.com/api/projects/status/9lft2tlamcox8epq?svg=true)](https://ci.appveyor.com/project/sztomi/callme) [![Coverage Status](https://img.shields.io/codecov/c/github/rpclib/rpclib/dev.svg)](https://img.shields.io/codecov/c/github/rpclib/rpclib/dev.svg) ![Coverity](https://scan.coverity.com/projects/7259/badge.svg?flat=1) [![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg?maxAge=2592000)](https://gitter.im/rpclib/Lobby)\n\n## Status\n\n**[rpclib is looking for maintainers](https://github.com/rpclib/rpclib/issues/273)**\n\nIf you're looking for a similar library with support for JSON-RPC and async operations, check out **[packio](https://github.com/qchateau/packio)**.\n\n## Overview\n\n`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:\n\n  * Expose functions of your program to be called via RPC (from any language\n    implementing msgpack-rpc)\n  * Call functions through RPC (of programs written in any language)\n  * No IDL to learn\n  * No code generation step to integrate in your build, just C++\n\n# Look\u0026feel\n\n## Server\n\n```cpp\n#include \u003ciostream\u003e\n#include \"rpc/server.h\"\n\nvoid foo() {\n    std::cout \u003c\u003c \"foo was called!\" \u003c\u003c std::endl;\n}\n\nint main(int argc, char *argv[]) {\n    // Creating a server that listens on port 8080\n    rpc::server srv(8080);\n\n    // Binding the name \"foo\" to free function foo.\n    // note: the signature is automatically captured\n    srv.bind(\"foo\", \u0026foo);\n\n    // Binding a lambda function to the name \"add\".\n    srv.bind(\"add\", [](int a, int b) {\n        return a + b;\n    });\n\n    // Run the server loop.\n    srv.run();\n\n    return 0;\n}\n```\n\nWhen `srv.run()` is called, `rpclib` starts the server loop which listens to incoming connections\nand tries to dispatch calls to the bound functions. The functions are called from the thread where\n`run` was called from. There is also `async_run` that spawns worker threads and returns\nimmediately.\n\n## Client\n\n```cpp\n#include \u003ciostream\u003e\n#include \"rpc/client.h\"\n\nint main() {\n    // Creating a client that connects to the localhost on port 8080\n    rpc::client client(\"127.0.0.1\", 8080);\n\n    // Calling a function with paramters and converting the result to int\n    auto result = client.call(\"add\", 2, 3).as\u003cint\u003e();\n    std::cout \u003c\u003c \"The result is: \" \u003c\u003c result \u003c\u003c std::endl;\n    return 0;\n}\n```\n\n# Status\n\nAll planned 1.0.0 features are done and tested; the current state is production-ready.\n\n# Who uses rpclib?\n\nThis list is updated as I learn about more people using the library; let me\nknow if you don't want your project listed here.\n\n  * [Microsoft AirSim](https://github.com/Microsoft/AirSim)\n\n# Thanks\n\n`rpclib` builds on the efforts of fantastic C++ projects. In no particular order:\n\n  * [MessagePack implementation for C and C++](https://github.com/msgpack/msgpack-c) by Takatoshi Kondo ([website](http://msgpack.org/))\n  * [asio](https://github.com/chriskohlhoff/asio) by Christopher Kohlhoff ([website](http://think-async.com/Asio))\n  * [cppformat](https://github.com/fmtlib/fmt) (now renamed `fmtlib`, by Victor Zverovich ([website](http://fmtlib.net))\n  * [googletest](https://github.com/google/googletest) by Google\n  * [wheels](https://github.com/rmartinho/wheels) by Martinho Fernandes\n\nShoutouts to\n\n  * [Appveyor](https://www.appveyor.com/)\n  * [Travis CI](https://travis-ci.org)\n  * [Coveralls.io](https://coveralls.io/)\n  * [Coverity](http://www.coverity.com)\n  * [ASan \u0026 TSan](https://github.com/google/sanitizers) helped spotting and resolving many bugs.\n\n\n\n\n","funding_links":[],"categories":["TODO scan for Android support in followings","Inter-process communication","进程间通信","Networking","\u003ca name=\"C%2B%2B\"\u003e\u003c/a\u003eC++","C++"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frpclib%2Frpclib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frpclib%2Frpclib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frpclib%2Frpclib/lists"}