• Core
  • Actions
  • getWebSocketProvider

getWebSocketProvider

Action for accessing the Client's ethers WebSocket Provider.

import { getWebSocketProvider } from '@wagmi/core'

Usage

import { getWebSocketProvider } from '@wagmi/core'
 
const webSocketProvider = getWebSocketProvider()

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 { getWebSocketProvider } from '@wagmi/core'
 
const webSocketProvider = getWebSocketProvider({
  chainId: 1,
})