Hi, I’m trying to subscribe to logs of a large number of token contracts using websockets. After 1000, I get the error “too many logs subscriptions, unsubscribe from existing subscriptions before creating more”. Is it possible to increase the subscription limit? 1500 subscriptions would be enough for me. If not, is there a way to subscribe to multiple tokens in one subscription? Thanks
Hi @dillysfriend - welcome to the Infura community! What are you needing that number of subs on a single connection for?
I have a large number of tokens and token owner addresses I want to be able to get balances for when needed. My previous method was to poll the blockchain for the balance every time I needed to know the balance of a token. However, if I needed multiple token balances at once, it would take a relatively long time, since I would have to send a request for every balance I wanted to check.
My current solution is to subscribe to all the tokens at startup. Then I poll the blockchain only the first time I need a balance of a token. I record the current balance, then from then on out if I receive a transfer update from the token subscription, I update the recorded balance on my side. Then if I need the balance in the future, I can poll my server and return the balance instantly instead of polling the blockchain. This does work and I can get the balances instantly after the first request, but I can only do it for the first 1000 tokens in my list.
If there’s a different recommended method, I’m open to trying it!
Thanks for the additional context! As of right now, unfortunately there isn’t a way to increase that subscription limit. If we come up with a better workaround than what you’re currently using, I’ll definitely give you an update!