GServerStreamingCall

public class GServerStreamingCall<Request, Response> : ICall where Request : Message, Response : Message

A server streaming Grebe call.

The client sends a request to the server and gets a sequence of response messages back.

Example usage of GServerStreamingCall

Consider the following protobuf definition for a simple echo service. The service defines one server streaming RPC. You send one message and it echoes a stream of messages back to you.

syntax = "proto3";

service EchoService {
    rpc echo (EchoRequest) returns (stream EchoResponse);
}

message EchoRequest {
    string message = 1;
}

message EchoResponse {
    string message = 1;
}

You can create a GServerStreamingCall like this:

GServerStreamingCall(request: EchoRequest.with { $0.message = "hello"}, closure: echo)
  • Declaration

    Swift

    public typealias CallClosure = (
        _ request: Request,
        _ callOptions: CallOptions?,
        _ handler: @escaping (Response) -> Void
    ) -> GRPC.ServerStreamingCall<Request, Response>
  • The request message for the call.

    Declaration

    Swift

    public var request: Request
  • Declaration

    Swift

    public let callClosure: CallClosure
  • Declaration

    Swift

    public let callOptions: CallOptions?
  • Sets up an new server streaming Grebe call.

    Declaration

    Swift

    public init(
        request: Request,
        callOptions: CallOptions? = nil,
        closure: @escaping CallClosure
    )

    Parameters

    request

    The request message for the call.

    callOptions

    Options to use for each service call.

    closure

    The closure which contains the executable call.

  • Executes the Grebe server streaming call.

    Declaration

    Swift

    public func execute() -> AnyPublisher<Response, GRPCStatus>

    Return Value

    A stream of Response elements. The response publisher may fail with a GRPCStatus error.