Open
Description
Hi,
I would like to know how can I setup the following options (available in your lib v0.x) in the lib v1.0.0-alpha.XX, see Channel.Attributes
:
- maxReceiveMessageLength
- maxSendMessageLength
- maxConcurrentStreams
- http2EnableTrueBinary
extension Channel {
public enum Argument {
/// Should we allow receipt of true-binary data on http2 connections?
/// Defaults to on (true)
public static func http2EnableTrueBinary(_ value: Bool) -> Channel.Argument { return .boolValued(key: "grpc.http2.true_binary", value: value) }
/// Maximum number of concurrent incoming streams to allow on a http2 connection.
public static func maxConcurrentStreams(_ value: UInt32) -> Channel.Argument { return .integerValued(key: "grpc.max_concurrent_streams", value: Int32(value)) }
/// Maximum message length that the channel can receive (in byts).
/// -1 means unlimited.
public static func maxReceiveMessageLength(_ value: Int32) -> Channel.Argument { return .integerValued(key: "grpc.max_receive_message_length", value: value) }
/// Maximum message length that the channel can send (in bytes).
/// -1 means unlimited.
public static func maxSendMessageLength(_ value: Int32) -> Channel.Argument { return .integerValued(key: "grpc.max_send_message_length", value: value) }
}
}
Below, you can see example of my code - how I configure Channel
using v1.0.0-alpha.XX - I also interested in the options described above. Unfortunately, I can't find similar options in the v1.0.0-alpha.XX. Can you please provide more info how to set these setting up ? Maybe couple of examples from you ? Or maybe your recommendations about alternative options (solution) available in v1.0.0-alpha.XX ?
lazy var grpcFilesServiceClient = {
Files_FilesServiceClient(channel: makeGrpcClientConnection(
group: self.grpcGroup,
useSSL: AppSettings.backendUseSSL,
grpcClientLabel: Files_FilesServiceClient.typeName
))
}()
. . .
private func makeGrpcClientConnection(group: EventLoopGroup, useSSL: Bool, grpcClientLabel: String) -> ClientConnection {
let builder = useSSL
? ClientConnection.secure(group: group)
: ClientConnection.insecure(group: group)
// !!!!!!! Please, see here !!!!!!!
// UNFORTUNATELY, I can't find similar options (described above) in
// the ClientConnection Builder in v1.0.0-alpha.XX
builder
.withBackgroundActivityLogger(self.logger)
.withCallStartBehavior(.waitsForConnectivity)
.withHTTPTargetWindowSize(65535)
.withConnectionReestablishment(enabled: true)
.withConnectionIdleTimeout(.minutes(1))
.withConnectionTimeout(minimum: .seconds(10))
.withConnectionBackoff(retries: .upTo(2))
.withKeepalive(ClientConnectionKeepalive(
interval: .seconds(20),
timeout: .seconds(10),
permitWithoutCalls: true,
maximumPingsWithoutData: 2,
minimumSentPingIntervalWithoutData: .minutes(1)
))
.withErrorDelegate(GrpcClientConnectionErrorDelegate(grpcClientLabel))
.withConnectivityStateDelegate(GrpcClientConnectivityStateDelegate(grpcClientLabel, logger: self.logger))
return builder.connect(host: AppSettings.backendHost, port: AppSettings.backendPort)
}