GRPC Objective-C  1.71.0
Instance Methods | Class Methods
GRPCInterceptor Class Reference

Base class for a gRPC interceptor. More...

#import <GRPCInterceptor.h>

Instance Methods

(instancetype) - NS_UNAVAILABLE
 
(nullable instancetype) - initWithInterceptorManager:dispatchQueue:
 Initialize the interceptor with the next interceptor in the chain, and provide the dispatch queue that this interceptor's methods are dispatched onto. More...
 
(void) - startWithRequestOptions:callOptions:
 To start the call. More...
 
(void) - writeData:
 To write data to the call. More...
 
(void) - finish
 To finish the stream of requests. More...
 
(void) - cancel
 To cancel the call. More...
 
(void) - receiveNextMessages:
 To indicate the call that the previous interceptor is ready to receive more messages. More...
 
(void) - didReceiveInitialMetadata:
 Issued when initial metadata is received from the server. More...
 
(void) - didReceiveData:
 Issued when gRPC message is received from the server. More...
 
(void) - didCloseWithTrailingMetadata:error:
 Issued when a call finished. More...
 
(void) - didWriteData
 Issued when flow control is enabled for the call and a message written with GRPCCall2::writeData is passed to gRPC core with SEND_MESSAGE operation. More...
 
- Instance Methods inherited from <GRPCResponseHandler>
(void) - didReceiveRawMessage:
 Issued when a message is received from the server. More...
 

Class Methods

(instancetype) + NS_UNAVAILABLE
 

Additional Inherited Members

- Properties inherited from <GRPCDispatchable>
dispatch_queue_t dispatchQueue
 The dispatch queue where the object's methods should be run on. More...
 

Detailed Description

Base class for a gRPC interceptor.

The implementation of the base class provides default behavior of an interceptor, which is simply forward a request/callback to the next/previous interceptor in the chain. The base class implementation uses the same dispatch queue for both requests and callbacks.

An interceptor implementation should inherit from this base class and initialize the base class with [super initWithInterceptorManager:dispatchQueue:] for the default implementation to function properly.

Method Documentation

◆ cancel

- (void) cancel

To cancel the call.

Reimplemented from <GRPCInterceptorInterface>.

◆ didCloseWithTrailingMetadata:error:

- (void) didCloseWithTrailingMetadata: (nullable NSDictionary *)  trailingMetadata
error: (nullable NSError *)  error 

Issued when a call finished.

If the call finished successfully, error is nil and trailingMetadata consists any trailing metadata received from the server. Otherwise, error is non-nil and contains the corresponding error information, including gRPC error codes and error descriptions.

Reimplemented from <GRPCResponseHandler>.

◆ didReceiveData:

- (void) didReceiveData: (id)  data

Issued when gRPC message is received from the server.

The data is always decompressed with gRPC or HTTP compression algorithm specified in the response header. data could be any type as transport layer and interceptors may modify the type of the data (e.g. a Protobuf interceptor may consume NSData typed data and issue GPBMessage typed data to user). Users should interpret data according to the configuration of their calls. Interceptor authors should not assume the type of data unless an agreement is made on how it should be used in a particular call setting.

Reimplemented from <GRPCResponseHandler>.

◆ didReceiveInitialMetadata:

- (void) didReceiveInitialMetadata: (nullable NSDictionary *)  initialMetadata

Issued when initial metadata is received from the server.

Reimplemented from <GRPCResponseHandler>.

◆ didWriteData

- (void) didWriteData

Issued when flow control is enabled for the call and a message written with GRPCCall2::writeData is passed to gRPC core with SEND_MESSAGE operation.

Reimplemented from <GRPCResponseHandler>.

◆ finish

- (void) finish

To finish the stream of requests.

Reimplemented from <GRPCInterceptorInterface>.

◆ initWithInterceptorManager:dispatchQueue:

- (nullable instancetype) initWithInterceptorManager: (GRPCInterceptorManager *)  interceptorManager
dispatchQueue: (dispatch_queue_t)  dispatchQueue 

Initialize the interceptor with the next interceptor in the chain, and provide the dispatch queue that this interceptor's methods are dispatched onto.

◆ NS_UNAVAILABLE [1/2]

+ (instancetype) NS_UNAVAILABLE

◆ NS_UNAVAILABLE [2/2]

- (instancetype) NS_UNAVAILABLE

◆ receiveNextMessages:

- (void) receiveNextMessages: (NSUInteger)  numberOfMessages

To indicate the call that the previous interceptor is ready to receive more messages.

Reimplemented from <GRPCInterceptorInterface>.

◆ startWithRequestOptions:callOptions:

- (void) startWithRequestOptions: (GRPCRequestOptions *)  requestOptions
callOptions: (GRPCCallOptions *)  callOptions 

To start the call.

This method will only be called once for each instance.

Reimplemented from <GRPCInterceptorInterface>.

◆ writeData:

- (void) writeData: (id)  data

To write data to the call.

Reimplemented from <GRPCInterceptorInterface>.


The documentation for this class was generated from the following file: