https://github.com/nymphium/grpc-ocaml
gRPC-Core wrapper for OCaml
https://github.com/nymphium/grpc-ocaml
grpc ocaml
Last synced: 7 months ago
JSON representation
gRPC-Core wrapper for OCaml
- Host: GitHub
- URL: https://github.com/nymphium/grpc-ocaml
- Owner: Nymphium
- License: mit
- Archived: true
- Created: 2022-05-27T05:20:43.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-10-25T09:42:28.000Z (about 3 years ago)
- Last Synced: 2025-06-05T22:09:26.893Z (7 months ago)
- Topics: grpc, ocaml
- Language: OCaml
- Homepage:
- Size: 22 MB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
grpc-ocaml
===
[gRPC-Core](https://github.com/grpc/grpc) bindings for OCaml
- [x] Connection with insecure credentials
- [ ] Connection with credentials
- [x] Unary RPC
- [ ] Server streaming RPC
- [ ] Client streaming RPC
- [ ] Bidirectional streaming RPC
- [x] Interceptors in server
- [ ] Interceptors in client
# requirements
- libgrpc (>= 1.45)
# Package details
- `grpc.stub` ... just a C FFI using ctypes
- `grpc.core` ... wrappers for `grpc.stub` with lwt
- `grpc.basic` ... utilities (logger and header) for client and servers
- `grpc.client` ... client library using `gpc.core` with ocaml-protoc-plugin
- `grpc.server` ... server library using `grpc.core` with ocaml-protoc-plugin
# Demo
```shell
$ direnv allow
$ dune exec example/server/main.exe &
main.exe: [DEBUG] run gRPC echo server on localhost:50051 ...
$ dune exec example/client/main.exe
main.exe: [grpc.server] get request on /grpc_test.Echo/Greet
main.exe: [DEBUG] x-foo:
main.exe: [DEBUG] request-id: request-id-is-9344
main.exe: [grpc.server] send response in 0.000029 sec
1
main.exe: [grpc.server] get request on /grpc_test.Echo/Greet
main.exe: [DEBUG] x-foo:
main.exe: [DEBUG] request-id: request-id-is-26685
main.exe: [grpc.server] send response in 0.000015 sec
2
main.exe: [grpc.server] get request on /grpc_test.Echo/Greet
main.exe: [DEBUG] x-foo:
main.exe: [DEBUG] request-id: request-id-is-30182
main.exe: [grpc.server] send response in 0.000015 sec
3
main.exe: [grpc.server] get request on /grpc_test.Echo/Greet
main.exe: [DEBUG] x-foo:
main.exe: [DEBUG] request-id: request-id-is-31641
main.exe: [grpc.server] send response in 0.000015 sec
4
main.exe: [grpc.server] get request on /grpc_test.Echo/Greet
main.exe: [DEBUG] x-foo:
main.exe: [DEBUG] request-id: request-id-is-30439
main.exe: [grpc.server] send response in 0.000027 sec
5
main.exe: [DEBUG] response: hello
```
# TODO
- remove all the `grep TODO`s
- implement [interop test](https://github.com/grpc/grpc/blob/master/doc/interop-test-descriptions.md)
- credentials
- support other RPCs not implemented
- documentation