GRPCService
public protocol GRPCService
GRPCService is a protocol that is implemented to declare gRPC services that can contain remote procedure calls.
This protocol requires services to contain a serviceName and provide a handleMethodmethod that maps requests to call handlers which can call the procedures.
-
serviceNameDefault implementationA string containing the services name.
Default Implementation
The default implementation of the
serviceNamereturns the last part of the services class or struct name using reflection.Declaration
Swift
var serviceName: String { get } -
handleMethod(methodName:Default implementationvaporRequest: ) Returns associated call handler of the service for a procedure call name and the associated Vapor
Request.This method is usually generated by the code generator for every
GRPCService.Default Implementation
The default implementation of the
handleMethodmethod always returnsnil. T This implementation should be overriden by the code generated for every service. The default implementation however is provided in order to prevent syntax errors before running the code generator and developers from implementing this method themselves.Declaration
Swift
func handleMethod(methodName: String, vaporRequest: Request) -> AnyCallHandler?Parameters
methodNameStringwith the name of the called remote procedure.Return Value
An
AnyCallHandlercall handler that calls the requested procedure.
View on GitHub
GRPCService Protocol Reference