reportingmonkey
reportingmonkey

Reputation: 185

How to set gRPC keepalive in Dart client

How can I adjust the keepalive parameters for a Dart gRPC client?

There is a page defining keepalive options: https://github.com/grpc/grpc/blob/master/doc/keepalive.md.

It describes these as "channel arguments".

I've seen examples of this being done in Python, for example here: https://www.cs.mcgill.ca/~mxia3/2019/02/23/Using-gRPC-in-Production/

When creating a channel in Dart I use ChannelOptions(), which supports named parameters credentials, idleTimeout and backOffStrategy, e.g.

client = ClientChannel(
       'localhost',
        port: 50051,
        options: ChannelOptions(
          credentials: credentials,
          //idleTimeout: Duration(minutes: 1),
          //backOffStrategy: backOffstrategy
        ));

  }

How or where do I set the channel arguments?

Upvotes: 5

Views: 1013

Answers (2)

HW Kim
HW Kim

Reputation: 475

UPDATE ON JUNE 22, 2023

Keepalive has been implemented to Grpc dart

for more information check below pull request

grpc-dart keepalive pull request

Upvotes: 0

Alexandre Ardhuin
Alexandre Ardhuin

Reputation: 76333

gRPC keepalive is not yet implemented. There's a tracking issue to add KeepAlive support you can upvote.

Upvotes: 3

Related Questions