diff --git a/src/objective-c/GRPCClient/GRPCCall+ChannelArg.h b/src/objective-c/GRPCClient/GRPCCall+ChannelArg.h index 0c3f37de812..b6d3938af00 100644 --- a/src/objective-c/GRPCClient/GRPCCall+ChannelArg.h +++ b/src/objective-c/GRPCClient/GRPCCall+ChannelArg.h @@ -46,9 +46,11 @@ typedef NS_ENUM(NSInteger, GRPCCompressAlgorithm) { + (void)setDefaultCompressMethod:(GRPCCompressAlgorithm)algorithm forhost:(nonnull NSString *)host; -/** Configure keepalive timeout parameters. A client ping after \a interval ms to check if the - * transport is still alive. After waiting for \a timeout ms, if the client does not receive the - * ping ack, it closes the transport. */ +/** Enable keepalive and configure keepalive parameters. A user should call this function once to + * enable keepalive for a particular host. gRPC client sends a ping after every \a interval ms to + * check if the transport is still alive. After waiting for \a timeout ms, if the client does not + * receive the ping ack, it closes the transport; all pending calls to this host will fail with + * error GRPC_STATUS_INTERNAL with error information "keepalive watchdog timeout". */ + (void)setKeepaliveWithInterval:(int)interval timeout:(int)timeout forHost:(nonnull NSString *)host; diff --git a/src/objective-c/tests/InteropTests.m b/src/objective-c/tests/InteropTests.m index 66fea22c830..7a8bc9bd79d 100644 --- a/src/objective-c/tests/InteropTests.m +++ b/src/objective-c/tests/InteropTests.m @@ -515,6 +515,9 @@ BOOL isRemoteInteropTest(NSString *host) { } else { // Keepalive should kick after 1s elapsed and fails the call. XCTAssertNotNil(error); + XCTAssertEqual(error.code, GRPC_STATUS_INTERNAL); + XCTAssertEqualObjects(error.localizedDescription, @"keepalive watchdog timeout", + @"Unexpected failure that is not keepalive watchdog timeout."); XCTAssertTrue(done); [expectation fulfill]; }