gRPC-haskell
gRPC-haskell copied to clipboard
Running multiple different gRPC services on the same port/endpoint?
Is it possible? Any examples?
@tim2CF: It is possible, albeit very awkward using the current API. The way you could do it in theory is to essentially implement something similar to the code that is generated by compile-proto-file for running a server.
Specifically, when you create a service named Foo, then compile-proto-file will generate a fooServer :: Foo ServerRequest ServerResponse -> ServiceOptions -> IO () that unpacks the service methods and repacks them into the server handlers to run a server on a single port. You could similar unpack the methods of multiple services and pack them into the handlers for a server in the same way as the generated code, but it would not be very ergonomic.
Thanks for reply, @Gabriel439 It's not critical issue at the moment, but in the future it will be very handy