GRPCStreamRequest
public class GRPCStreamRequest<RequestModel, ResponseModel> : GRPCRequestType where RequestModel : GRPCModel, ResponseModel : GRPCModel
Undocumented
-
Vapor
Request
from which the gRPC request was instantiated. This reference is required by theGRPCRequestType
protocol.Declaration
Swift
public var vaporRequest: Request
-
Handles incoming messages from the
messageStream
by 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
onNext
A closure that gets a single
RequestModel
value to handle from the stream and returnsVoid
Return Value
A succeeded future of the type
Void
that succeeds when the stream has ended and theforEach
method has been called for every message. -
Collects incoming messages from the
messageStream
and returns a future with an array of the collectedRequestModel
s.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
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. -
Undocumented
Declaration
Swift
public func sendEnd()
-
Undocumented
Declaration
Swift
public func respondforEach(onNext: @escaping ((RequestModel) -> ResponseModel))