1

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!

1 Answer 1

0

Try this wss://ropsten.infura.io/ws/v3/YOUR-PROJECT-ID

This work for me in Ropsten

4
  • Thank you for your comment. I also tried that but didn't work. What version of Web3 are you using?
    – rutex
    Commented Apr 3, 2019 at 22:02
  • Web3 - 1.0.0-beta.34 How I use endpoint new Web3('wss://ropsten.infura.io/ws/v3/MyKEY') Anyway, this works for me only on Ropsten in Mainnet not work. Commented Apr 4, 2019 at 11:06
  • Well, maybe then is something related to using version 1.0.0-beta.36. I try with beta.34 and see if this works... Thanks!
    – rutex
    Commented Apr 7, 2019 at 7:01
  • I just tried with version 34 and still doesn't work, same error :-(
    – rutex
    Commented Apr 7, 2019 at 7:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.