---
title: "Connection State"
description: "Monitor the Convex realtime connection and react to disconnects in your UI."
canonical_url: "https://nuxt-convex.onmax.me/vue-guide/connection-state"
---
# Connection State

> Monitor the Convex realtime connection and react to disconnects in your UI.

Use `useConvexConnectionState` when you want to show connectivity status or pause parts of the UI while the realtime client is offline.

## Read the connection state

```vue [src/components/ConnectionBanner.vue]
<script setup lang="ts">
import { useConvexConnectionState } from 'vue-convex'

const { state, isConnected } = useConvexConnectionState()
</script>

<template>
  <div v-if="!isConnected" class="banner">
    Reconnecting...
  </div>
</template>
```

## What the composable gives you

- `state` exposes the underlying Convex `ConnectionState` object, or `null` when no realtime client is connected
- `isConnected` is a convenience computed that maps to `state.value?.isWebSocketConnected`

Useful fields on `state.value` include:

- `isWebSocketConnected`
- `hasInflightRequests`
- `hasEverConnected`
- `connectionCount`
- `inflightMutations`

## Verify the result

The connection-state wiring is working when:

- `isConnected` reflects the current socket state
- disconnecting the client updates your UI
- reconnecting clears the offline indicator

## Next steps

- Read [Controller](https://nuxt-convex.onmax.me/vue-guide/controller) if your app connects and disconnects explicitly
- Read [`useConvexConnectionState`](https://nuxt-convex.onmax.me/api-reference/use-convex-connection-state) for the exact return type


## Sitemap

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