Whenever I try to connect to Infura using the websocket subprovider, this error pops up:
WebSocket connection to 'wss://ropsten.infura.io/ws/' failed: Error during WebSocket handshake: Sent non-empty 'Sec-WebSocket-Protocol' header but no response was received
If I change
this._socket = new WebSocket(this._url, null, {origin: this._origin})
to
this._socket = new WebSocket(this._url, [], {origin: this._origin})
then the connection will work correctly.
I noticed there are 2 open PRs that involve this same line of code and that have gotten no response, #286 and #290, but neither of them addresses this issue, as leaving that second parameter null or undefined will cause the error.
I am happy to open the PR to fix this if you guys are ok with that, let me know.
Hi everyone.
Whenever I try to connect to Infura using the websocket subprovider, this error pops up:
It does work when connecting to Ganache.
I am using the latest version,
14.1.0
My code:The problem seems to lie at this particular line on the websocket subprovider: https://github.com/MetaMask/provider-engine/blob/master/subproviders/websocket.js#L145
If I change
this._socket = new WebSocket(this._url, null, {origin: this._origin})
tothis._socket = new WebSocket(this._url, [], {origin: this._origin})
then the connection will work correctly.I noticed there are 2 open PRs that involve this same line of code and that have gotten no response, #286 and #290, but neither of them addresses this issue, as leaving that second parameter
null
orundefined
will cause the error.I am happy to open the PR to fix this if you guys are ok with that, let me know.