warp-grpc: A minimal gRPC server on top of Warp.

[ bsd3, library, networking ] [ Propose Tags ]
Versions [RSS],,,,,,,
Change log ChangeLog.md
Dependencies async (>=2.2.1 && <3), base (>=4.10 && <5), binary (>=0.8.5 && <0.9), bytestring (>=0.10.8 && <0.11), case-insensitive (>=1.2.0 && <1.3), http-types (>=0.12 && <0.13), http2 (>=1.6 && <3), http2-grpc-types (>=0.5 && <0.6), unliftio-core (>=0.1 && <0.3), wai (>=3.2 && <3.4), warp (>=3.2.23 && <3.4), warp-tls (>=3.2 && <3.4) [details]
License BSD-3-Clause
Copyright 2017 - 2020 Lucas DiCioccio, Alejandro Serrano
Author Lucas DiCioccio, Alejandro Serrano
Maintainer lucas@dicioccio.fr
Category Networking
Home page https://github.com/haskell-grpc-native/http2-grpc-haskell#readme
Bug tracker https://github.com/haskell-grpc-native/http2-grpc-haskell/issues
Source repo head: git clone https://github.com/haskell-grpc-native/http2-grpc-haskell
Uploaded by AlejandroSerrano at 2020-03-25T14:34:36Z
Reverse Dependencies 4 direct, 0 indirect [details]
Downloads 3438 total (22 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for warp-grpc-

[back to package description]


A gRPC server implementation on top of Warp's HTTP2 handler. The lib also contains a demo sever using the awesome grpcb.in Proto. The current release is an advanced technical demo, expect a few breaking changes.


The library implements gRPC using a WAI middleware for a set of gRPC endpoints. Endpoint handlers differ depending of the streaming/unary-ty of individual RPCs. Bidirectional streams will be supported next.

There is little specification around the expected allowed observable states in gRPC, hence the types this library presents make conservative choices: unary RPCs expect an input before providing an output. Client stream allows to return an output only when the client has stopped streaming. Server streams wait for an input before starting to iterate sending outputs.


Generate some proto-lens code from .proto files, ideally in a separate library. Import this library and the generated proto-lens code to implement handlers for the service stanzas defined in the .proto files (see Haddocks). Finally, serve warp over TLS`.


Please refer to https://github.com/lucasdicioccio/warp-grpc-example for an example.

TODO(ldicioccio): migrate this example to the new monorepo.

Next steps

  • Helper to set metadatas (a.k.a., headers and trailers).
    • (API-breaking) some or all handlers will get an IO-step to return extra metadata
  • Helper to map request headerlists into client metadatas (probably in http2-grpc-types)


  • Only supports "h2" with TLS (I'd argue it's a feature, not a bug. Don't @-me)
  • Some valid gRPC applications may not be expressible directly on top of warp because sending HTTP2 trailers (i.e., signalling the server's desire to stop sending messages) is correlated with closing the HTTP2 stream (i.e., stop accepting client messages). Hence it's not feasible to create a bidirectional stream that terminates on the server end while continuing to ingest client messages. This use case, however, seems like a corner case.