FQL v4 will be decommissioned on June 30, 2025. Ensure that you complete your migration from FQL v4 to FQL v10 by that date. For more details, review the migration guide. Contact support@fauna.com with any questions. |
Connections
The Fauna database service provides an HTTP endpoint where client applications can send their queries and expect to get 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 Fauna database. Multiple asynchronous queries can be active at once using the CCO, where HTTP connections are established as needed.
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 database and its role, which decide whether the query should be
executed. See the Security section for details.
Connection options
Parameter | Type | Definition and Requirements |
---|---|---|
|
String |
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. |
|
String |
Optional - The endpoint URL to connect to. The default is
|
|
Number |
Optional - A query timeout expressed in milliseconds. After a query is sent, if the timeout period elapses without a response from Fauna, the connection for the query 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 with custom HTTP request headers and their associated values. |
|
Boolean |
Optional - When |
Most of the parameters listed below are function calls. Go does not support optional function parameters, so specifying optional values must be handled with function calls. |
Parameter | Type | Definition and Requirements |
---|---|---|
|
String |
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 with the current client connection object. When the timeout has elapsed without a response from Fauna, the connection for the query 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. |
|
String |
Optional - A function to configure the endpoint URL to connect to.
The default endpoint URL is |
|
String |
Optional - A function that accepts a MetricRegistry which registers and tracks connection-level metrics. |
|
String |
Optional - A function that accepts a transaction timeout, expressed in milliseconds. The timeout applies to all queries executed with the current client connection object. When the timeout has elapsed without a response from Fauna, the connection for the query is closed. The default timeout is 60,000 milliseconds (60 seconds). |
|
String |
Optional - A function that accepts a string to use in the HTTP
|
|
|
Optional - A function that accepts a string map with custom HTTP request headers and their associated values. |
|
String |
Optional - A function that accepts a boolean. When The default is |
Parameter | Type | Definition and Requirements |
---|---|---|
|
String |
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. |
|
String |
Optional - The endpoint URL to connect to. The default is
|
|
String |
Optional - The domain name of the target endpoint. The default is
|
|
Number |
Optional - The port of the target endpoint. The default is |
|
String |
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. |
|
Boolean |
Optional - When The default is |
|
Object |
Optional - An object that is used to define custom HTTP headers. |
|
A function |
Optional - A function that provides a custom implementation of
|
|
Number |
Optional - A query timeout expressed in milliseconds. After a query is sent, if the timeout period elapses without a response from Fauna, the HTTP connection is closed and the result is abandoned. |
|
Number |
Optional - A timeout expressed in milliseconds. It specifies the maximum time that an HTTP/2 session can remain active with no activity. The timeout only applies to query connections. Streaming connections are intended to be held open indefinitely. The default is |
Parameter | Type | Definition and Requirements |
---|---|---|
|
String |
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. |
|
String |
Optional - The endpoint URL to connect to. The default is
|
|
String |
Optional - The domain name of the target endpoint. The default is
|
|
Number |
Optional - The port of the target endpoint. The default is |
|
Number |
Optional - The HTTP scheme of the target endpoint. The default is
|
|
Number |
Optional - A query timeout expressed in seconds. After a query is 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 |
|
Number |
Optional - The number of HTTP connections to save in the connection pool. |
|
Number |
Optional - The maximum number of HTTP connections to save in the pool. |
Parameter | Type | Definition and Requirements |
---|---|---|
|
String |
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. |
|
String |
Optional - The endpoint URL to connect to. The default is
|
|
A |
Optional - A |
|
Number |
Optional - A query timeout expressed in milliseconds. After a query is sent, if the timeout period elapses without a response from Fauna, the connection for the query is closed. |
|
String |
Optional - Specifies a custom HTTP |
|
|
Optional - A string map with custom HTTP request headers and their associated values. |
|
Boolean |
Optional - When The default is |
There are no connection options available for the Dashboard Shell.
Multiple connections
When 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.
Is this article helpful?
Tell Fauna how the article can be improved:
Visit Fauna's forums
or email docs@fauna.com
Thank you for your feedback!