[bisq-network/bisq] POC Bisq gRPC for gRPC and REST clients (#4275)
notifications at github.com
Wed Jun 3 18:17:57 UTC 2020
I was semantically wrong to characterise this gateway proxy as something that enables Bisq to work with RESTful clients. So... oops. Doing so was a time eater.
What it does is expose one web endpoint mapped to the single gRPC service. This single gRPC service performs all implemented Bisq functions, whether requests come from a browser (HTTP 1.1) or gRPC client (HTTP2).
Instead of using URL element paths for passing method names & parameters, all method names & params are passed in the request body, like a web form. That's not RESTful. I was trying to combine most of the thoughts @cbeams recorded for the #grpc-api channel ( keybase://team/bisq/2020-05-18%20api%20next%20steps ) into one experiment: just have a single pass-through gRPC service that takes method names + parameters, and expose the one gRPC service to RESTful web clients. (This kind of web client is not RESTful.)
Right now (if using go grpc-gateway), I can only think of one way of implementing a single pass-through gRPC service that could serve gRPC and RESTful clients:
1. Use the POC's `CallService#call(String params)`, or something similar, to serve all gRPC clients. (Keep the client simple.)
2. For RESTful clients, define a gRPC service for each method, and use those gRPC services as pass throughs to the above gRPC `CallService#call(String params)`.
`/method1/param1/val1` maps to gRPC service `Method1Service#call(param1, ..., paramN)`, `Method1` returns `CallService#call(String params)`
`/method1/param1/val1/paramN/valN` maps to gRPC service `Method1Service#call(param1, ..., paramN)`, `Method1` returns `CallService#call(String params)`
`/method2/param/val` maps to gRPC service `Method2Service#call(param)`, `Method2` returns `CallService#call(String params)`
[Go grpc-gateway](https://github.com/grpc-ecosystem/grpc-gateway) protos can be used to map multiple URLs with the same base path element to a single gRPC method, but each unique method (with a unique base path element) needs to be mapped to a unique gRPC service.
I didn't do that because I wanted to see how exposing one gRPC service to gRPC and web clients might work.
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the bisq-github