getConnection method

RubixServiceClient getConnection({
  1. required String gateway,
  2. required String accessToken,
  3. Duration idleTimeout = const Duration(minutes: 5),
})

Implementation

RubixServiceClient getConnection(
    {required String gateway,
    required String accessToken,
    Duration idleTimeout = const Duration(minutes: 5)}) {
  ClientChannel channel = ClientChannel(gateway,
      port: Const.PORT,
      options: ChannelOptions(
          credentials: ChannelCredentials.insecure(),
          idleTimeout: idleTimeout));
  return RubixServiceClient(channel,
      options:
          CallOptions(metadata: {'Authorization': 'Bearer $accessToken'}));
}