Connections
Fauna’s database service provides an HTTP endpoint where client applications can send their queries and expect to receive responses for those queries.
Each connection is a standard lightweight HTTP connection that typically lasts for the duration that a query is executing. Some drivers support persisting a connection using HTTP keep-alive.
Each driver implements its own connection management, so your client applications do not need to implement connection pools, or other connection management strategies.
The client connection object
Each driver implements a client connection object (CCO), which represents a logical connection to a specific Fauna database. Multiple asynchronous queries can be active at once via the CCO, where query-specific HTTP connections are established as needed.
Connections are not possible using Shell syntax
The string YOUR_FAUNA_SECRET
needs to be replaced with the secret from
a key, token, or
with the JWT provided by a third-party
identity provider.
The secret
is an authentication+authorization token that is associated
with a specific database and specific permissions, which determine
whether the query should be executed. See the Security
section for details.
Connection options
Parameter | Type | Definition and Requirements |
---|---|---|
|
The authorization token which is associated with the database that you want to query. It can be the secret from a key, token, or it can be a JWT from the third-party identity provider. |
|
|
Optional - The endpoint URL to connect to. The default is
|
|
|
Optional - A query timeout expressed in milliseconds. After a query has been sent, if the timeout period elapses without a response from Fauna, the query’s connection is closed. |
|
|
An |
Optional - An instantiated HTTP client object that is compatible with
the .Net Core |
|
|
Optional - When using the default |
|
|
Optional - A string dictionary containing custom HTTP request headers and their associated values. |
|
Optional - When |
Most of the parameters listed below are actually function calls. Go does not support optional function parameters, so specifying optional values must be handled with function calls. |
Parameter | Type | Definition and Requirements |
---|---|---|
|
The authorization token which is associated with the database that you want to query. It can be the secret from a key, token, or it can be a JWT from the third-party identity provider. |
|
|
A function that accepts a String |
Optional - A function to configure the endpoint URL to connect to.
The default endpoint URL is |
|
A function that accepts a pointer to a replacement |
Optional - A function to configure a replacement |
|
A function that accepts a list of HTTP headers to send with queries |
Optional - A function to configure a list of HTTP headers to send with queries. |
|
A function that accepts a Number |
Optional - The function to configure a transaction timeout, expressed in milliseconds. The timeout applies all queries executed via the current client connection object. When the timeout has elapsed without a response from Fauna, the query’s connection is closed. The default timeout is 60,000 milliseconds (60 seconds). |
|
A function that accepts a pointer to an |
Optional - A function to configure an |
The Java driver uses the Builder pattern to compose the options for the client connection object. Each option must be expressed as a builder function call. |
Parameter | Type | Definition and Requirements |
---|---|---|
|
A function that accepts a String |
The String is the authorization token which is associated with the database that you want to query. It can be the secret from a key, token, or it can be a JWT from the third-party identity provider. |
|
Optional - A function to configure the endpoint URL to connect to.
The default endpoint URL is |
|
|
Optional - A function that accepts a MetricRegistry which registers and tracks connection-level metrics. |
|
|
Optional - A function that accepts a transaction timeout, expressed in milliseconds. The timeout applies to all queries executed via the current client connection object. When the timeout has elapsed without a response from Fauna, the query’s connection is closed. The default timeout is 60,000 milliseconds (60 seconds). |
|
|
Optional - A function that accepts a string to use in the HTTP
connection’s |
|
|
|
Optional - A function that accepts a string map containing custom HTTP request headers and their associated values. |
|
Optional - A function that accepts a boolean. When The default is |
Parameter | Type | Definition and Requirements |
---|---|---|
|
This is the authorization token which is associated with the database that you want to query. It can be the secret from a key, token, or it can be a JWT from the third-party identity provider. |
|
|
Optional - The domain name of the target endpoint. The default is
|
|
|
Optional - The port of the target endpoint. The default is |
|
|
Optional - The HTTP scheme of the target endpoint. The default is
|
|
|
A callback function |
Optional - When defined, the callback function is called with the raw HTTP response object for every query executed. |
|
Optional - When The default is |
|
|
Optional - An object that is used to define custom HTTP headers. |
|
|
A function |
Optional - A function that provides a custom implementation of
|
|
Optional - A query timeout expressed in milliseconds. After a query has been sent, if the timeout period elapses without a response from Fauna, the HTTP connection is closed and the result is abandoned. |
|
|
Optional - A timeout expressed in milliseconds. It specifies the maximum time that an HTTP/2 session can remain active with no activity. This is most useful for event streaming clients. |
Parameter | Type | Definition and Requirements |
---|---|---|
|
This is the authorization token which is associated with the database that you want to query. It can be the secret from a key, token, or it can be a JWT from the third-party identity provider. |
|
|
Optional - The domain name of the target endpoint. The default is
|
|
|
Optional - The port of the target endpoint. The default is |
|
|
Optional - The HTTP scheme of the target endpoint. The default is
|
|
|
Optional - A query timeout expressed in seconds. After a query has been sent, if the timeout period elapses without a response from Fauna, the HTTP connection is closed and the result is abandoned. |
|
|
A function |
Optional - When the |
|
Optional - The number of HTTP connections to save in the connection pool. |
|
|
Optional - The maximum number of HTTP connections to save in the pool. |
Parameter | Type | Definition and Requirements |
---|---|---|
|
This is the authorization token which is associated with the database that you want to query. It can be the secret from a key, token, or it can be a JWT from the third-party identity provider. |
|
|
Optional - The endpoint URL to connect to. The default is
|
|
|
A |
Optional - A |
|
Optional - A query timeout expressed in milliseconds. After a query has been sent, if the timeout period elapses without a response from Fauna, the query’s connection is closed. |
|
|
Optional - Specifies a custom HTTP |
|
|
|
Optional - A string map containing custom HTTP request headers and their associated values. |
|
Optional - When The default is |
Multiple connections
Whenever you need to connect to Fauna using different secrets, endpoints, or other settings, create a new client connection object for each different kind of connection that you need to use.
Examples
The following example demonstrates how to connect to a Fauna instance
running in the United States (US)
Region Group:
Connections are not possible using Shell syntax
The following example demonstrates how to connect to a
Fauna Dev instance running on localhost
on
port 8443
:
Connections are not possible using Shell syntax
Was this article helpful?
We're sorry to hear that.
Tell us how we can improve!
Visit Fauna's forums
or email docs@fauna.com
Thank you for your feedback!