OptionalapiapiKey is the API key of the project. It is used to identify the project.
If not set, API key of the default project is used.
OptionalauthauthTokenInjector is a function that provides a token for the auth webhook.
When the webhook response status code is 401, this function is called to refresh the token.
The reason parameter is the reason from the webhook response.
OptionalchannelchannelHeartbeatInterval is the interval of the channel heartbeat (ms).
The client sends a RefreshChannel heartbeat to refresh the channel
session TTL. The default value is 5000 (ms) — co-tuned to the server's
ChannelSessionTTL (15 s) at TTL/3. Values larger than the server TTL
risk premature session expiry.
OptionaldeactivatedeactivateOnUnload controls whether the client registers a
beforeunload listener during activate() that deactivates the client
when the page is unloaded. The default value is true.
Setting this to false skips the listener registration. This is useful
for apps that don't need GC or presence cleanup on unload (for example,
disableGC documents without collaboration): the unload-time
deactivate becomes pure overhead and its fetch({ keepalive: true })
request can reject mid-flight during hard navigation, surfacing as an
unhandled [unknown] ConnectError. The server reaps the stale
client after its clientDeactivateThreshold, so opting out is safe.
Optionalkeykey is the client key. It is used to identify the client.
If not set, a random key is generated.
Optionalmetadatametadata is the metadata of the client. It is used to store additional
information about the client.
OptionalreconnectreconnectStreamDelay is the delay of the reconnect stream. If the stream
is disconnected, the client waits for the delay to reconnect the stream. The
default value is 1000(ms).
OptionalretryretrySyncLoopDelay is the delay of the retry sync loop. If the sync loop
fails, the client waits for the delay to retry the sync loop. The default
value is 1000(ms).
OptionalrpcrpcAddr is the address of the RPC server. It is used to connect to
the server.
OptionalsyncsyncLoopDuration is the duration of the sync loop. After each sync loop,
the client waits for the duration to next sync. The default value is
50(ms).
OptionaluseuseGrpcWebTransport determines the transport protocol.
If true, uses gRPC-Web transport for backward compatibility.
If false (default), uses Connect Protocol transport.
OptionaluseruserAgent is the user agent of the client. It is used to identify the
client.
ClientOptionsare user-settable options used when defining clients.