Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/angrymane/cap-sample
A sample rpc client and server using capnproto, EzPRCServer.
https://github.com/angrymane/cap-sample
capnproto rpc sample-code
Last synced: 17 days ago
JSON representation
A sample rpc client and server using capnproto, EzPRCServer.
- Host: GitHub
- URL: https://github.com/angrymane/cap-sample
- Owner: AngryMane
- Created: 2022-06-17T14:04:59.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-21T09:01:17.000Z (5 months ago)
- Last Synced: 2024-11-13T09:48:56.288Z (about 2 months ago)
- Topics: capnproto, rpc, sample-code
- Language: Rust
- Homepage:
- Size: 437 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# cap-sample
cap-sample is a sample rpc client and server using capnproto, TwoPartyClent and TwoPartyServer.
If you need a sample of EzRpcServer and Client, see older version of this repository.## Directory structure
```bash
$ tree -L 1
.
├── CMakeLists.txt # CMake config file
├── README.md # the file you are now reading right now
├── client # client project dir
│ ├── cpp
│ └── rust
├── docs # doxygen document
├── doxygen.conf # doxygen config
├── interface # capnproto schema and generated sources
└── server # server project dir
├── cpp
└── rust
```## RPC patterns
There are only only 2 patterns.
1. The client requests `initialize` event to the server
1. The client requests `subscribe` event to the server, and the server periodically pushes back `push_message` event.## Build capnproto interface, client and server
```bash
$ mkdir build
$ cd build
$ cmake ..
$ make
```## Usage
You can launch the server and connect client like below.
```bash
# run server implemented by cpp
$ ./build/server/cpp/server
# run server implemented by rust
$ ./build/server/rust/server_rust
# run client implemented by cpp
$ ./build/client/cpp/client
# run client implemented by rust
$ ./build/client/rust/client_rust
```## License
[MIT](https://choosealicense.com/licenses/mit/)