Frequent websocket disconnections

I’m subscribing to new blocks on BNB chain via Websocket (on the free plan, with plenty of API credits left), and it starts disconnecting after 20 mins. I have an auto-reconnect to handle this but then it just repeatedly re-connects and disconnects every 1-2 minutes. If I shut down the websocket and start again the same pattern occurs - everything’s ok for 20 mins, then repeated disconnections every 1-2 minutes.

Is this a problem with the free plan? Or would this also happen on a paid plan?

Hey rick :wave:,

We highly recommend checking out this post on websocket disconnects.

We strongly advise you check out QuickAlerts QuickAlerts - Real-Time Blockchain Notifications | QuickNode

You can set up alerts on almost anything to be alerted when something happens on-chain. You can read more about QuickAlerts at this page here.

-Nick

As I said, “I have an auto-reconnect to handle this”, everything mentioned in the post you recommended has been implemented already.

I’m specifically interested in understanding the mechanism at work here. Why does the websocket always start disconnecting after 20 mins, then repeated auto-connect and disconnect every couple of mins? Yet if I shut down my node.js script and start again, everything’s fine for another 20 mins. I’m not interested in alternatives like QuickAlerts, I just want to understand what the backend system is doing here.

My only assumption is that the free plan is subject to these programmed disconnections, which is fine, I’ll happily upgrade if that’s the case, but I don’t want to waste money if this problem will keep happening even on a paid account.

Hey Rick, plan level doesn’t influence WS disconnections. We’d love to assist you by checking out your script through our support team. Kindly open a ticket with us here so we can further investigate.

-Nick