GRPCServerStreamRequest

public class GRPCServerStreamRequest<RequestModel, ResponseModel> : GRPCRequestType where RequestModel : GRPCModel, ResponseModel : GRPCModel

A GRPCServerStreamRequest instance represents a server-streaming gRPC request that provides the single incoming value and sendResponse and sendEnd methods to send a multiple responses. It implements the GRPCRequestType that requires it to contain its Vapor Request and provides several shortcuts to several Vapor stack functionality. This is also a generic class which has two type constraits that implement the GRPCModel protocol. One constraint for the RequestModel type and one constraint for the ResponseModel.

Public Attributes

  • Single incoming RequestModel value which type is defined by the class constraint.

    Declaration

    Swift

    public let message: RequestModel
  • Vapor Request from which the gRPC request was instantiated. This reference is required by the GRPCRequestType protocol.

    Declaration

    Swift

    public var vaporRequest: Request

Public Methods

  • Sends a response of type ResponseModel by succeeding the promise of the previous message with the response message value and a promise for the next stream message.

    Declaration

    Swift

    public func sendResponse(message: ResponseModel)

    Parameters

    message

    Single outgoing ResponseModel object which will be sent as a response.

  • Ends the response stream by succeeding the promise of the previous message with a stream end message.

    Declaration

    Swift

    public func sendEnd()