gRPC Vapor is a Vapor middleware framework that enables Vapor servers to support, route, encode and decode gRPC requests.
This framework is designed to work together with the GRPCVaporGenerator which analyzes the declared gRPC services and messages and then generates the necessary supporting code to route requests, provide encoding and decoding support and provide a proto interface definition file.
This framework is like the 1.0 version of grpc-swift build ontop of SwiftNIO instead of the common C-Core for most implementations. This is due to usage of the Vapor as its networking component. The encoding and decoding of the gRPC messages is realized using the SwiftProtobuf framework.
This framework works with Vapor version 4.0 or higher and requires the Swift version to be 5.2 or higher.
The interface of this framework primarly consists of three main components that are needed to declare and integrate gRPC services in an existing Vapor application:
GRPCMiddlewarethat implements Vapors
Middlewareprotocol and can therefore be added to a Vapor application.
GRPCServiceprotocol that declares a structure or class as a gRPC service and provides a routing method for remote procedure calls.
GRPCModelprotocol that declares a structure or class as a gRPC message that can be used as an input or output of remote procedure calls.
Using call handlers GRPCMessage GRPCRequest GRPCStream
Instructions to integrate
If you want to contribute your own ideas and changes to feel free to create a github issue or contact me directly via e-mail email@example.com.