I tried to connect to ETH network through websocket,however it always fail.
Here is my code:
from web3 import Web3
infura = ‘wss://mainnet.infura.io/ws/v3/MY_PROJECT_ID’
w3 = Web3(Web3.WebsocketProvider(infura))
the result is False always. What’s wrong with my code?
Hey @77036553, and welcome to the Infura community!
I see you’re following the web3py docs, which say that should be true. We can duplicate that and have determined that the connection isn’t actually ever being opened, so of course, that
w3.isConnected is returning false! Those docs aren’t the most intuitive, so hang tight while we work to figure out how to get that connection opened successfully.