Skip to content
Docs
Hooks
useWebSocketProvider

useWebSocketProvider

Hook for accessing the Client's ethers WebSocket Provider.

import { useWebSocketProvider } from 'wagmi'

Usage

import { useWebSocketProvider } from 'wagmi'

function App() {
  const webSocketProvider = useWebSocketProvider()
}

Return Value

WebSocketProvider

Configuration

chainId (optional)

Force a specific chain id. The wagmi Client's ethers webSocketProvider must be set up as a chain-aware function for this to work correctly.

import { useProvider } from 'wagmi'

function App() {
  const provider = useProvider({
    chainId: 1,
  })
}