---
title: "useConvexConnectionState"
description: "Reference for the shared composable that reflects the realtime connection state."
canonical_url: "https://nuxt-convex.onmax.me/api-reference/use-convex-connection-state"
---
# useConvexConnectionState

> Reference for the shared composable that reflects the realtime connection state.

`useConvexConnectionState` exposes the current Convex realtime connection state.

## Import

```ts [Nuxt]
const { state, isConnected } = useConvexConnectionState()
```

```ts [Vue]
import { useConvexConnectionState } from 'vue-convex'
```

## Signature

```ts
function useConvexConnectionState(): {
  state: Readonly<Ref<ConnectionState | null>>
  isConnected: ComputedRef<boolean>
}
```

## Behavior

- Returns `null` when no realtime client is connected
- `isConnected` maps to `state.value?.isWebSocketConnected`
- Tracks connection changes after `connect()`, `reconfigure()`, and `disconnect()`

## Related pages

- [Connection State](https://nuxt-convex.onmax.me/vue-guide/connection-state)
- [useConvexController](https://nuxt-convex.onmax.me/api-reference/use-convex-controller)


## Sitemap

See the full [sitemap](https://nuxt-convex.onmax.me/sitemap.md) for all pages.
