grpc-node
grpc-node copied to clipboard
How do I set options in grpc from firebase?
This is related to https://github.com/grpc/grpc-node/issues/1769#issuecomment-902053418.
I want to set options like grpc.keepalive_time_ms
, grpc.keepalive_timeout_ms
and grpc.keepalive_permit_without_calls
. How do I set them?
Is this the way?
GRPC_ARG_KEEPALIVE_TIME_MS=10000
GRPC_ARG_KEEPALIVE_TIMEOUT_MS=10000
Or can I do this?
const grpc = require("@grpc/grpc-js")
grpc.keepalive_time_ms = 10000;
I don't understand from the documentation how I can augment grpc to behave as wanted when using the firebase-admin sdk.
3rd parameter to the client under options attribute. Like this:
const DEFAULT_OPTIONS = {
'grpc.max_connection_age_grace_ms': DEFAULT_DEADLINE + GRACE_PERIOD_MARGIN ,
'grpc.dns_min_time_between_resolutions_ms': DNS_MIN_TIME_BETWEEN_RESOLUTIONS_MS,
....
};
const defaultConfig = {
....
options: DEFAULT_OPTIONS,
};
const Client = grpc.makeGenericClientConstructor({});
const client = new Client(address, defaultConfig.credentials, defaultConfig.options);
Thanks @jorge07. Does this work in my case? I am not creating the client for firebase-admin so how do I make sure firebase-admin uses this grpc client?
This question should be addressed to the firebase-admin repository. They can tell you how to use their APIs to pass options to grpc-js.