getConnection method

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

Implementation

RubixExternalClient 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 RubixExternalClient(channel,
      options:
          CallOptions(metadata: {'Authorization': 'Bearer $accessToken'}));
}