I am trying to connect to Ropsten with Web3js (1.0) via Infura using their WebSocket provider but I am getting the following error:
WebSocket connection to 'wss://ropsten.infura.io/ws' failed: Received a broken close frame containing a reserved status code.
This error shows up when I try to invoke a function from a contract using the send()
method from Web3js. No issues arise at the time of creating my web3 instance, which by the way I create as follows:
web3 = new Web3(new Web3.providers.WebsocketProvider("wss://ropsten.infura.io/ws"))
Since the error I am getting says something related to a closed frame I tried something I found here regarding the clientConfig frame size with no success:
web3 = new Web3(new Web3.providers.WebsocketProvider("wss://ropsten.infura.io/ws", {
clientConfig: {
maxReceivedFrameSize: 100000000,
maxReceivedMessageSize: 100000000,
}
}))
I have also seen some other threads (e.g. here, here, here) related to WebSocket connection errors to Infura but none of them seem to be dealing with the same problem.
Thanks in advance!