• Core
  • Actions
  • getWebSocketPublicClient

getWebSocketPublicClient

Action for accessing viem's WebSocket Public Client.

import { getWebSocketPublicClient } from '@wagmi/core'

Usage

import { getWebSocketPublicClient } from '@wagmi/core'
 
const publicClient = getWebSocketPublicClient()

Return Value

PublicClient

Configuration

chainId (optional)

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

import { getWebSocketPublicClient } from '@wagmi/core'
 
const publicClient = getWebSocketPublicClient({
  chainId: 1,
})