-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: CONNECTION ERROR: Couldn't connect to node on WS. #140
Comments
Same issue, it will connect to the WS, then about 5 seconds later will close the connection. Workflow: I have some code to reconnect the WS on close and it successfully says it reconnects. It then goes on to instantiate some event listeners and that is when this error shows up. It say's it reconnected, and the code has worked to this point and actually did reconnect. When attempting to start the event listeners the error "connection not open on send()" doesn't show up so I assume it is 'connected' but something else if failing. Some other things to note in my situation: Same code works perfectly for Ropsten test-net replacing "wss://mainnet.infura.io/ws" with "wss://ropsten.infura.io/ws". Also with web3 version 1.0.0-beta.20 the error states: Error: CONNECTION ERROR: Couldn't connect to node on IPC (instead of WS) <-- Not sure if that is relevant at all. Lastly, if I re-deploy my application many times, once in awhile with the same code it'll work and properly connect/stay connected. |
Confirming - ran into this issue today. Saw something about TLS 1.2 handshake being required? Anyone confirm that works? |
Ran into this issue today, does anyone know what exactly is causing this? |
I have the same issue - appears to only be on mainnet as ropsten works fine. The error returned on mainnet is
For reference, the code that is executed before this error is:
Did anyone have luck figuring this out? I am also using |
@sudosammy this looks to be related to your logs query, which is scanning the entire blockchain and thus taking too long to complete so the websocket connection appears idle and you are disconnected. Try using a smaller query on only the most recent, say, ~1000 blocks. The data from older blocks will never change so should be cached in your Dapp, not queried from the chain each time the Dapp is loaded. The reason this works on ropsten is that its a much smaller chain with less events, so the query can be performed in time. |
Thanks @ryanschneider - you're completely right, I was being too lazy with my filter. Cheers. |
I use this code at https://infura.io/docs/wss/introduction
I got error message when run:
I'm using web3 version 1.0.0-beta.36.
The text was updated successfully, but these errors were encountered: