GRPCStreamRequest
public class GRPCStreamRequest<RequestModel, ResponseModel> : GRPCRequestType where RequestModel : GRPCModel, ResponseModel : GRPCModel
Undocumented
-
Vapor
Requestfrom which the gRPC request was instantiated. This reference is required by theGRPCRequestTypeprotocol.Declaration
Swift
public var vaporRequest: Request
-
Handles incoming messages from the
messageStreamby calling the passed closure for each of these messages. It calls the closure for the next message as soon as the next message arrived.Declaration
Swift
public func forEach(onNext: @escaping ((RequestModel) -> Void)) -> EventLoopFuture<Void>Parameters
onNextA closure that gets a single
RequestModelvalue to handle from the stream and returnsVoidReturn Value
A succeeded future of the type
Voidthat succeeds when the stream has ended and theforEachmethod has been called for every message. -
Collects incoming messages from the
messageStreamand returns a future with an array of the collectedRequestModels.Declaration
Swift
public func collect() -> EventLoopFuture<[RequestModel]>Return Value
A succeeded future of the type
[RequestModel]that succeeds with an array of every incoming messages once the stream has ended.
-
Sends a response of type
ResponseModelby 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
messageSingle outgoing
ResponseModelobject which will be sent as a response. -
Undocumented
Declaration
Swift
public func sendEnd()
-
Undocumented
Declaration
Swift
public func respondforEach(onNext: @escaping ((RequestModel) -> ResponseModel))
View on GitHub
GRPCStreamRequest Class Reference