Skip to main content

Interface: ConnectionOptions

client.ConnectionOptions

gRPC and Temporal Server connection options

Properties

address

Optional address: string

The address of the Temporal server to connect to, in hostname:port format.

Port defaults to 7233. Raw IPv6 addresses must be wrapped in square brackets (e.g. [ipv6]:port).

Default

localhost:7233

apiKey

Optional apiKey: string | () => string

API key for Temporal. This becomes the "Authorization" HTTP header with "Bearer " prepended. This is mutually exclusive with the Authorization header in ConnectionOptions.metadata.

You may provide a static string or a callback. Also see Connection.withApiKey or Connection.setApiKey


callCredentials

Optional callCredentials: CallCredentials[]

gRPC call credentials.

CallCredentials generaly modify metadata; they can be attached to a connection to affect all method calls made using that connection. They can be created using some of the factory methods defined here

If callCredentials are specified, they will be composed with channel credentials (either the one created implicitely by using the tls option, or the one specified explicitly through credentials). Notice that gRPC doesn't allow registering callCredentials on insecure connections.


channelArgs

Optional channelArgs: ChannelOptions

GRPC Channel arguments

See

option descriptions here

By default the SDK sets the following keepalive arguments:

grpc.keepalive_permit_without_calls: 1
grpc.keepalive_time_ms: 30_000
grpc.keepalive_timeout_ms: 15_000

To opt-out of keepalive, override these keys with undefined.


connectTimeout

Optional connectTimeout: Duration

Milliseconds to wait until establishing a connection with the server.

Used either when connecting eagerly with Connection.connect or calling Connection.ensureConnected.

Format

number of milliseconds or ms-formatted string

Default

10 seconds

credentials

Optional credentials: ChannelCredentials

gRPC channel credentials.

ChannelCredentials are things like SSL credentials that can be used to secure a connection. There may be only one ChannelCredentials. They can be created using some of the factory methods defined here

Specifying a prebuilt ChannelCredentials should only be required for advanced use cases. For simple TLS use cases, using the tls property is recommended. To register CallCredentials (eg. metadata-based authentication), use the callCredentials property.

Either tls or this may be specified for configuring TLS


interceptors

Optional interceptors: Interceptor[]

gRPC interceptors which will be applied to every RPC call performed by this connection. By default, an interceptor will be included which automatically retries retryable errors. If you do not wish to perform automatic retries, set this to an empty list (or a list with your own interceptors). If you want to add your own interceptors while keeping the default retry behavior, add this to your list of interceptors: makeGrpcRetryInterceptor(defaultGrpcRetryOptions()). See:


metadata

Optional metadata: Metadata

Optional mapping of gRPC metadata (HTTP headers) to send with each request to the server. Setting the Authorization header is mutually exclusive with the apiKey option.

In order to dynamically set metadata, use Connection.withMetadata


tls

Optional tls: null | boolean | TLSConfig

TLS configuration. Pass a falsy value to use a non-encrypted connection, or true or {} to connect with TLS without any customization.

For advanced scenario, a prebuilt grpc.ChannelCredentials object may instead be specified using the credentials property.

Either credentials or this may be specified for configuring TLS

Default

TLS is disabled