useVexConnectionStatus
useVexConnectionStatus():
VexConnectionStatus
Defined in: packages/react/src/hooks/useVexConnectionStatus.ts:58
The admin’s view of the Convex client’s connection, for the top bar’s status pill and any
replacement an app registers under admin.components.connectionStatus.
Reads ConvexReactClient.connectionState() and re-renders from subscribeToConnectionState();
the only timers are the two escalation timeouts below, never polling. The server render (and the
hydrating client render) use a fixed never-connected snapshot instead of calling
connectionState(), which would construct the client’s sync layer and open a WebSocket from
the server on every request — the reason this does not use convex’s own
useConvexConnectionState().
States:
connecting— never connected yet (first paint, or anexpectAuthsocket waiting for auth).connected— socket open, and also for the first 2 s after a drop so brief blips don’t flicker.reconnecting— dropped for 2 s or more after having connected.offline— disconnected for 10 s, whether or not it ever connected.
Must render under convex’s ConvexProvider.
Returns
Section titled “Returns”The current VexConnectionStatus.