Websockets stop getting events after some time

We are using BSC Testnet websockets(pro plan) to listen to events and after sometime we stop getting events even when the transaction is successful.

maybe you have to reconnect from time to time, you don’t get any error? it just stops working

Yup, no error or disconnection. Just stop showing up events after some time. We are using nodejs backend, by reconnect you mean adding options while passing the wss provider or restarting the whole backend?

By reconnecting I mean passing options.

Can you try to send a ping request every second?

We tried the default options, doesn’t seem to help. Can you point us to any documentation/guide for passing the options? Will test them out and update here. Thanks.

I don’t know what are the recommended options, I know that these type of options

worked sometimes, but it doesn’t seem to be the same case here

Ok thanks, let us try these options.

Still having the same issue, after adding the options and sending a ping request every 30s. It worked for 2 days without any issue and this error popped up again.

did you try with another node provider?

we recommend using a server for syncing events

https://docs.moralis.io/moralis-dapp/automatic-transaction-sync/smart-contract-events#sync-and-watch-contract-events