Cannot connect to Websocket

Hello. Yesterday I connected to my WSS SpeedyNode from Polygon. It worked fine for a couple of hours but now it does not want to connect anymore.
Even with options and without options.

const options = {

  // Enable auto reconnection

  reconnect: {

      auto: true,

      delay: 5000, // ms

      maxAttempts: 5,

      onTimeout: false

  }

};

var web3 = new Web3(new Web3.providers.WebsocketProvider('wss://speedy-nodes-nyc.moralis.io/CENSORED/polygon/mainnet', options));

My Static Website: https://jbzjujos7v1k.moralisweb3.com

ERR: browser.js:28 WebSocket connection to ‘wss://speedy-nodes-nyc.moralis.io/CENSORED/polygon/mainnet/ws’ failed:

Could you please tell us what error you receive?

1 Like

WebSocket connection to ‘wss://speedy-nodes-nyc.moralis.io/CENSORED/polygon/mainnet/ws’ failed: browser.js:28

Hey @lococo

You have sent not a full error message. There should be error message after browser.js:28 WebSocket connection to ‘wss://speedy-nodes-nyc.moralis.io/CENSORED/polygon/mainnet/ws’ failed:

How do you handle errors messaged? Alert, console?

I’ve just tested your code and connection to BSC and Polygon networks - everything works correctly.

I guess you just reached the request limit. What kind of node requests are you making?

1 Like

Like I said. It worked perfectly for hours. I also was assuming that it has to do something with the request limit. However Krasimir in DC told me that he doesn’t think it has something to do with the limit.

I am subscribed to /syncing events of two smart contracts (dont hate me because im not using plugin :D). However… even if I only set web3 provider without any following code it gives me a the connection failed message which I posted in console.

Hi,
I think that Yomoo wanted to say that you pasted only partially the error message, that doesn’t look like a complete error message from what you pasted, only the beginning of it.

Thats the only message I get in console

you mean is nothing after failed:?

s @ browser.js:28

Basically only this

I do mean right this

I get this error running directly your code:

browser.js:28 WebSocket connection to 'wss://speedy-nodes-nyc.moralis.io/.../polygon/mainnet' failed: 

I have a friend. And for him everything works perfectly. If I want to connect nothing happens but the error code.

Is my IP banned ? =D

I don’t know what is the fix, sometimes it works for me, sometimes I get your error.

First problem looks to be that you have
var web3 = new Web3(new Web3.providers.WebsocketProvider('wss://speedy-nodes-nyc.moralis.io/CENSORED/polygon/mainnet', options));
instead of
var web3 = new Web3(new Web3.providers.WebsocketProvider('wss://speedy-nodes-nyc.moralis.io/CENSORED/polygon/mainnet/ws', options));

and after that maybe you get banned

how can I get unbanned? Because this maybe happened

I’m not sure you really get banned, but after waiting some time it worked for me to use web sockets requests. It looked like a temporarily ban for me.

You could try to change IP, or use VPN if you have that option.

hmm… I still cannot connect seems like my IP is perma banned.

Confusing

Yup works if I use internet of my phone. My IP is banned for sure

@lococo, can you test again now with your main IP?