{"id":13418562,"url":"https://github.com/cinemast/libjson-rpc-cpp","last_synced_at":"2025-05-15T12:02:34.262Z","repository":{"id":6169213,"uuid":"7398979","full_name":"cinemast/libjson-rpc-cpp","owner":"cinemast","description":"C++ framework for json-rpc (json remote procedure call)","archived":false,"fork":false,"pushed_at":"2024-01-02T12:43:08.000Z","size":2112,"stargazers_count":964,"open_issues_count":19,"forks_count":324,"subscribers_count":74,"default_branch":"master","last_synced_at":"2025-05-15T12:02:28.125Z","etag":null,"topics":["c-plus-plus","cpp","json","json-rpc","json-rpc-client","json-rpc-server","json-rpc2","libjson-rpc-cpp","rpc","stub-generator"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cinemast.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.md"},"funding":{"github":"cinemast"}},"created_at":"2013-01-01T21:02:04.000Z","updated_at":"2025-05-14T02:29:09.000Z","dependencies_parsed_at":"2024-01-08T21:18:50.954Z","dependency_job_id":null,"html_url":"https://github.com/cinemast/libjson-rpc-cpp","commit_stats":{"total_commits":917,"total_committers":63,"mean_commits":"14.555555555555555","dds":0.5779716466739367,"last_synced_commit":"f9a13ef980a6e336a30b3147f6caeec6f58d1cc6"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cinemast%2Flibjson-rpc-cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cinemast%2Flibjson-rpc-cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cinemast%2Flibjson-rpc-cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cinemast%2Flibjson-rpc-cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cinemast","download_url":"https://codeload.github.com/cinemast/libjson-rpc-cpp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254337612,"owners_count":22054253,"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":["c-plus-plus","cpp","json","json-rpc","json-rpc-client","json-rpc-server","json-rpc2","libjson-rpc-cpp","rpc","stub-generator"],"created_at":"2024-07-30T22:01:03.790Z","updated_at":"2025-05-15T12:02:34.211Z","avatar_url":"https://github.com/cinemast.png","language":"C++","readme":"**I created a new C++17 header only implementation -\u003e [json-rpc-cxx](https://github.com/jsonrpcx/json-rpc-cxx).**\n\nMaster [![CircleCI](https://circleci.com/gh/cinemast/libjson-rpc-cpp/tree/master.svg?style=svg)](https://circleci.com/gh/cinemast/libjson-rpc-cpp/tree/master)\n[![codecov](https://codecov.io/gh/cinemast/libjson-rpc-cpp/branch/master/graph/badge.svg?token=QNoXsaI2ta)](https://codecov.io/gh/cinemast/libjson-rpc-cpp)\n\n\nlibjson-rpc-cpp\n===============\n\nThis framework provides cross platform JSON-RPC (remote procedure call) support for C++.\nIt is fully JSON-RPC [2.0 \u0026 1.0 compatible](http://www.jsonrpc.org/specification).\n\n![libjson-rpc-cpp logo](https://github.com/cinemast/libjson-rpc-cpp/blob/master/dev/artwork/logo.png?raw=true)\n\n**5 good reasons for using libjson-rpc-cpp in your next RPC project**\n- Full JSON-RPC 2.0 \u0026 partial JSON-RPC 1.0 client and server Support.\n- jsonrpcstub - a tool that generates stub-classes for your JSON-RPC client and server applications.\n- Ready to use HTTP + TCP server and client to provide simple interfaces for your JSON-RPC application.\n- Cross platform build support for Linux and OS X.\n- Super liberal [MIT-License](http://en.wikipedia.org/wiki/MIT_License).\n\n**Other good reasons to use libjson-rpc-cpp**\n- Easy to use [cmake](http://www.cmake.org) cross platform build system.\n- Clean and simple architecture, which makes it easy to extend.\n- Continuously tested under MacOS, and [various linux distributions](https://travis-ci.org/cinemast/libjson-rpc-cpp).\n- Automated testing using `make test`.\n- Useful Examples provided. e.g. XBMC Remote using json-rpc client part and stub generator.\n- The stubgenerator currently supports C++, JavaScript, and Python.\n\nOverview\n=========\n![libjson-rpc-cpp logo](dev/artwork/overview.png?raw=true)\n\nInstall the framework\n=====================\n\n**Debian (stretch) and Ubuntu (15.10 or later)**\n\n```sh\nsudo apt-get install libjsonrpccpp-dev libjsonrpccpp-tools\n```\n\n**Fedora**\n\n```sh\nsudo dnf install libjson-rpc-cpp-devel libjson-rpc-cpp-tools\n```\n\n**Arch Linux**\n\nFor Arch Linux there is a [PKGBUILD provided in the AUR](https://aur.archlinux.org/packages/libjson-rpc-cpp/).\n\n```sh\nsudo aura -A libjson-rpc-cpp\n```\n\n**Gentoo Linux**\n\n```sh\nsudo emerge dev-cpp/libjson-rpc-cpp\n```\n\n**Mac OS X**\n\nFor OS X a [Brew](http://brew.sh) package is available:\n```sh\nbrew install libjson-rpc-cpp\n```\n\n**Windows**\n\nThere is a ready to use compiled package [here](http://spiessknafl.at/libjson-rpc-cpp).\nJust download execute the installer EXE.\n\nBuild from source\n=================\nInstall the dependencies\n------------------------\n- [libcurl](http://curl.haxx.se/)\n- [libmicrohttpd](http://www.gnu.org/software/libmicrohttpd/)\n- [libjsoncpp](https://github.com/open-source-parsers/jsoncpp)\n- [libargtable](http://argtable.sourceforge.net/)\n- [cmake](http://www.cmake.org/)\n- [libhiredis](https://redislabs.com/lp/hiredis/)\n- [catch](https://github.com/catchorg/Catch2)\n\n**UNIX**\n\nFor Debian and Arch GNU/Linux based systems, all dependencies are available via the package manager.\nFor OS X all dependencies are available in [Brew](http://brew.sh)\n\nBuild\n-----\n\n```sh\ngit clone https://github.com/cinemast/libjson-rpc-cpp.git\nmkdir -p libjson-rpc-cpp/build\ncd libjson-rpc-cpp/build\ncmake .. \u0026\u0026 make\nsudo make install\nsudo ldconfig          #only required for linux\n```\nThat's it!\n\nIf you are not happy with it, simply uninstall it from your system using (inside the build the directory):\n```sh\nsudo make uninstall\n```\n\n**Build options:**\n\nDefault configuration should be fine for most systems, but here are available compilation flags:\n\n- `-DCOMPILE_TESTS=NO` disables unit test suite.\n- `-DCOMPILE_STUBGEN=NO` disables building the stubgenerator.\n- `-DCOMPILE_EXAMPLES=NO` disables examples.\n- `-DHTTP_SERVER=NO` disable the libmicrohttpd webserver.\n- `-DHTTP_CLIENT=NO` disable the curl client.\n- `-DREDIS_SERVER=NO` disable the redis server connector.\n- `-DREDIS_CLIENT=NO` disable the redis client connector.\n- `-DUNIX_DOMAIN_SOCKET_SERVER=YES` enable the unix domain socket server connector.\n- `-DUNIX_DOMAIN_SOCKET_CLIENT=YES` enable the unix domain socket client connector.\n- `-DFILE_DESCRIPTOR_SERVER=NO` disable the file descriptor server connector.\n- `-DFILE_DESCRIPTOR_CLIENT=NO` disable the file descriptor client connector.\n- `-DTCP_SOCKET_SERVER=NO` disable the tcp socket server connector.\n- `-DTCP_SOCKET_CLIENT=NO` disable the tcp socket client connector.\n\nUsing the framework\n===================\nThis example will show the most simple way to create a rpc server and client. If you only need the server, ignore step 4. If you only need the client, ignore step 3. You can find all resources of this sample in the `src/examples` directory of this repository.\n\n### Step 1: Writing the specification file ###\n\n```json\n[\n\t{\n\t\t\"name\": \"sayHello\",\n\t\t\"params\": {\n\t\t\t\"name\": \"Peter\"\n\t\t},\n\t\t\"returns\" : \"Hello Peter\"\n\t},\n\t{\n\t\t\"name\" : \"notifyServer\"\n\t}\n]\n```\n\nThe type of a return value or parameter is defined by the literal assigned to it. The generated stubs will will use the \"returns\" type to validate the response. In this example you can see how to specify methods and notifications.\n\n### Step 2: Generate the stubs for client and server ###\n\nCall jsonrpcstub:\n```sh\njsonrpcstub spec.json --cpp-server=AbstractStubServer --cpp-client=StubClient\nmkdir -p gen\nmv abstractstubserver.h gen\nmv stubclient.h gen\n```\n\nThis generates an `AbstractStubServer` and a `StubClient` class and moves them to the `gen` folder.\n\n\n### Step 3: implement the abstract server stub ###\n\nExtend the abstract server stub and implement all pure virtual (abstract) methods defined in `spec.json`.\n\nSee [src/examples/stubserver.cpp](src/examples/stubserver.cpp)\n\n\nIn the main function the concrete server is instantiated and started. That is all for the server. Any JSON-RPC 2.0 compliant client can now connect to your server.\n\nCompile the server with:\n\n```sh\ng++ stubserver.cpp -ljsoncpp -lmicrohttpd -ljsonrpccpp-common -ljsonrpccpp-server -o sampleserver\n```\n\n### Step 4: Create the client application\n\n\nSee [src/examples/stubclient.cpp](src/examples/stubclient.cpp)\n\n\nCompile the client with:\n\n```sh\ng++ stubclient.cpp -ljsoncpp -lcurl -ljsonrpccpp-common -ljsonrpccpp-client -o sampleclient\n```\n\n## Contributions\n\nPlease take a look at [CONTRIBUTING.md](CONTRIBUTING.md)\n\nYou can also donate via [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=CJV4LY486L838\u0026source=url)\n\n## Changelogs\n\nChangelogs can be found [here](CHANGELOG.md).\n\n## API compatibility\nWe do our best to keep the API/ABI stable, to prevent problems when updating this framework.\nA compatiblity report can be found [here](http://upstream.rosalinux.ru/versions/libjson-rpc-cpp.html).\n\n## License\nThis framework is licensed under [MIT](http://en.wikipedia.org/wiki/MIT_License).\nAll of this libraries dependencies are licensed under MIT compatible licenses.\n\n\nReferences\n==========\n- [NASA Ames Research Center](http://www.nasa.gov/centers/ames/home/): use it to obtain aircraft state information from an aircraft simulator.\n- [LaseShark 3D Printer](https://github.com/macpod/lasershark_3dp): used to control the firmware of the 3D printer.\n- [cpp-ethereum](https://github.com/ethereum/cpp-ethereum): C++ implementations for the ethereum crypto currency.\n- [mage-sdk-cpp](https://github.com/mage/mage-sdk-cpp): a game engine.\n- [bitcodin](http://www.bitmovin.net): a scalable cloud based video transcoding platform.\n- [wgslib](http://wgslib.com/): a web geostatistics library.\n- [bitcoin-api-cpp](https://github.com/minium/bitcoin-api-cpp): a C++ interface to bitcoin.\n- [NIT DASH Content Server](http://www.nit.eu/offer/research-projects-products/334-http2dash): Dynamic Adaptive Streaming over HTTP server.\n\nIf you use this library and find it useful, I would be very pleased if you let me know about it.\n","funding_links":["https://github.com/sponsors/cinemast","https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=CJV4LY486L838\u0026source=url"],"categories":["TODO scan for Android support in followings","Inter-process communication","Networking","Remote Procedure Call","进程间通信"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcinemast%2Flibjson-rpc-cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcinemast%2Flibjson-rpc-cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcinemast%2Flibjson-rpc-cpp/lists"}