Using aqueduct with gRPC [enhancement]
+1
i got grpc working with flutter. it saves alot of work and is fast. would be awesome with aqueduct behind it
What all does this entail?
Grpc is just codegen with protoc. Heaps of examples. You can do bi-directional streaming.
Then just have aqueduct under the dart server generated code.
You will get much higher perf and you client and server code stays in sync
+1
@joeconwaystk, we would like to see this officially supported in aqueduct. Is this enhancement planned for any upcoming aqueduct release?
Not currently planned. I don't know much about gRPC, nor how it would be surfaced as a feature of Aqueduct. If someone is able to help plan what they'd like an interface/toolchain to look like, I'd be happy to look at how it'd be implemented and put together a timeline.
I am slowly working to have gPRC with Aqueduct, but to get it working I got a channel with grpc server instance on startup, that alone is single socket server and it limits on how many such channels can be created. Also Aqueduct supports single Channel - I bet for same reason. My gRPC service takes context for ORM and auth server (which integration I didn't finalized with gRPC auth)
maybe I create sample opensource project as battle test so I can share it
Looking forward to it!!! Thank you!
This seems like a neat idea but non trivial!
gRPC generates dart entities along with client and server stubs (including json serialization)- but those entities are not compatible with Aqueduct's ORM. You need a way to efficiently syncronize state between Aqueduct ORM classes and gRPC generated one - ideally with some kind of code generation so you don't need to write a bunch of redundant code.
I suppose one could use json serialization -but that largely defeats the performance benefit of using gRPC.
Thats assuming you want to use gRPC with your ORM which is not the case, you probably just want that as a contract between your endpoints as thats what its for. To replace the DTO layer.
I'm doing the opposite right now where I use Aqueduct for the ORM only, and then use dart server to host gRPC endpoints in Kube :)
@SKLn-Rad Interesting - can you elaborate on this architecture? Are you accepting gRPC requests in your Aqueduct process, then going straight to the ORM? (i.e. basically bypassing the Controller logic in Aquaduct?). Or something else?
Exactly. I have aqueduct bootstrapped in microservices which need access to their own schema but literally just use it as an ORM. Aside from that I am using grpc as seen in the examples to run a server. Difficult part was actually get things like tracing to work as their isnt a good solution yet for it.
no news about gRPC and aqueduct?