diff --git a/.changeset/weak-walls-cover.md b/.changeset/weak-walls-cover.md new file mode 100644 index 0000000..a9a626b --- /dev/null +++ b/.changeset/weak-walls-cover.md @@ -0,0 +1,5 @@ +--- +"@xmtp/grpc-api-client": patch +--- + +Adjust GRPC keepalive settings diff --git a/packages/grpc-api-client/src/GrpcApiClient.ts b/packages/grpc-api-client/src/GrpcApiClient.ts index 5121af3..51bc373 100644 --- a/packages/grpc-api-client/src/GrpcApiClient.ts +++ b/packages/grpc-api-client/src/GrpcApiClient.ts @@ -36,14 +36,21 @@ import { } from "./gen/message_api/v1/message_api.js" const API_URLS: { [k: string]: string } = { - dev: "dev.xmtp.network:5556", - production: "production.xmtp.network:5556", + dev: "grpc.dev.xmtp.network:443", + production: "grpc.production.xmtp.network:443", local: "localhost:5556", } const SLEEP_TIME = 1000 const MAX_RETRIES = 4 +const clientOptions = { + "grpc.keepalive_timeout_ms": 1000 * 10, // 10 seconds + "grpc.keepalive_time_ms": 1000 * 30, // 30 seconds + "grpc.enable_retries": 1, + "grpc.keepalive_permit_without_calls": 0, +} as const + export default class GrpcApiClient implements ApiClient { grpcClient: MessageApiClient private authCache?: AuthCache @@ -58,10 +65,7 @@ export default class GrpcApiClient implements ApiClient { this.grpcClient = new MessageApiClient( new GrpcTransport({ host: apiUrl, - clientOptions: { - "grpc.keepalive_time_ms": 1000 * 60 * 5, // 5 minutes - "grpc.enable_retries": 1, - }, + clientOptions, channelCredentials: isSecure ? credentials.createSsl() : credentials.createInsecure(),