Error 4040 Draining connection

I’m currently hitting this exception after some time while using Speedy Nodes:

websockets.exceptions.ConnectionClosedError: code = 4040 (private use), reason = Draining connection

What was the particular speedy node chain, were you able to reconnect successfully after that, after how much time usually it happens, how often it happens?


I’m using the BSC websocket speedy node, it is almost guaranteed to happen after between 15-30 minutes.

Hi @eXPerience

What type of data do you fetch?

I think you’re just hitting the limit ~ 3600 reqs/min.

Hi, I dont think i’m even close to 3600reqs/min…

I’m fetching transaction data of my contract.
Pseudocode of my program is as below.

while True:
  logs = w3.eth.get_logs({
    'fromBlock' : last,
    'toBlock': latest,
    'topics': [myfunction, None, contract_address]

  # do stuff

  last = w3.eth.block_number # RPC
  sleep(3)     # 3 seconds

@eXPerience send me your node address in DM

I don’t see your full code. But one of the possible reasons may be that there is a large interval between receiving information. And the websocket automatically closes the connection due to inactivity

where do I click to send DM?


asd Doesnt seem like I can message

Could you send it to my discord Dmitry Yomoo#0691