API Reference

useConvexConnectionState

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

useConvexConnectionState exposes the current Convex realtime connection state.

Import

Nuxt
const { state, isConnected } = useConvexConnectionState()
Vue
import { useConvexConnectionState } from 'vue-convex'

Signature

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()
Copyright © 2026