Skip to main content

Interface: BaseConvexClientOptions

browser.BaseConvexClientOptions

Options for BaseConvexClient.

Hierarchy

Properties

unsavedChangesWarning

Optional unsavedChangesWarning: boolean

Whether to prompt the user if they have unsaved changes pending when navigating away or closing a web page.

This is only possible when the window object exists, i.e. in a browser.

The default value is true in browsers.

Defined in

browser/sync/client.ts:59


webSocketConstructor

Optional webSocketConstructor: Object

Call signature

new webSocketConstructor(url, protocols?): WebSocket

Specifies an alternate WebSocket constructor to use for client communication with the Convex cloud. The default behavior is to use WebSocket from the global environment.

Parameters
NameType
urlstring | URL
protocols?string | string[]
Returns

WebSocket

Type declaration

NameType
prototypeWebSocket
CONNECTING0
OPEN1
CLOSING2
CLOSED3

Defined in

browser/sync/client.ts:66


verbose

Optional verbose: boolean

Adds additional logging for debugging purposes.

The default value is false.

Defined in

browser/sync/client.ts:72


logger

Optional logger: boolean | Logger

A logger, true, or false. If not provided or true, logs to the console. If false, logs are not printed anywhere.

You can construct your own logger to customize logging to log elsewhere.

Defined in

browser/sync/client.ts:79


reportDebugInfoToConvex

Optional reportDebugInfoToConvex: boolean

Sends additional metrics to Convex for debugging purposes.

The default value is false.

Defined in

browser/sync/client.ts:85


onServerDisconnectError

Optional onServerDisconnectError: (message: string) => void

Type declaration

▸ (message): void

This API is experimental: it may change or disappear.

A function to call on receiving abnormal WebSocket close messages from the connected Convex deployment. The content of these messages is not stable, it is an implementation detail that may change.

Consider this API an observability stopgap until higher level codes with recommendations on what to do are available, which could be a more stable interface instead of string.

Check connectionState for more quantitative metrics about connection status.

Parameters
NameType
messagestring
Returns

void

Defined in

browser/sync/client.ts:99


skipConvexDeploymentUrlCheck

Optional skipConvexDeploymentUrlCheck: boolean

Skip validating that the Convex deployment URL looks like https://happy-animal-123.convex.cloud or localhost.

This can be useful if running a self-hosted Convex backend that uses a different URL.

The default value is false

Defined in

browser/sync/client.ts:109


authRefreshTokenLeewaySeconds

Optional authRefreshTokenLeewaySeconds: number

If using auth, the number of seconds before a token expires that we should refresh it.

The default value is 2.

Defined in

browser/sync/client.ts:115