$createChannel method

  1. @override
GrpcOrGrpcWebClientChannel $createChannel(
  1. EndPoint endPoint
)
inherited

Implementation

@override
GrpcOrGrpcWebClientChannel $createChannel(EndPoint endPoint) {
  // This factory is only available on non-web platforms
  return GrpcOrGrpcWebClientChannel.grpc(
    endPoint.address,
    port: endPoint.port,
    options: ChannelOptions(
      credentials: $getOrAddCredentials(endPoint),
      // Workaround for grpc.keepalive_time_ms:
      // > After a duration of this time the client/server pings its peer
      // > to see if the transport is still alive.
      idleTimeout: settings.keepAliveInterval.isNone
          ? Defaults.GrpcIdleTimeout
          : settings.keepAliveTimeout,
      // Workaround for grpc.keepalive_timeout_ms:
      // > After waiting for a duration of this time, if the keepalive
      // > ping sender does not receive the ping ack, it will close
      // > the transport.
      connectionTimeout: settings.keepAliveTimeout.isNone
          ? Defaults.GrpcConnectionTimeout
          : settings.keepAliveTimeout,
    ),
  );
}