Maintain websocket subscription

Hello,

I was wondering what’s the right way of maintaining an active events subscription using go-ethereum’s ethclient with a WS provider set to Infura’s mainnet/ropsten network. I need to establish a bunch of subscriptions and listen for specific events, but the issue is that events might happen at some point in the future and by that time the subscription might expire (the default expiration is set to ~ 1h). Would really appreciate some help on the matter.

Thanks!

Hello,

I just want to clarify that subscriptions have an idle hour limit, not max hour limit. The connection is automatically disconnect only if the connection goes idle for 1hr+. Currently there’s no way to avoid the 1 hour idle limit. We recommend using a client that can ping the websocket connection from going idle. However, even with pinging enabled, we also recommend that clients should be able to reconnect a websocket connection that is disconnected for whatever reason. websocket connections are usually long standing, and can be disconnected due to a variety of different reasons.

Hopefully this helps,
Jee