Websocket subscription change addresses and topics

So basically what I want to know is if it’s possible (and if not the best practice to achieve it) to subscribe to log events with ‘eth_subscribe’ of say [n addresses] and [m topics] and later change those topics to for example [n + 5 addresess] and [m + 10 topics] by using the subscriptionID.
Is there any way to do this without unsubscribing and resubscribing, I’d like to keep just 1 subscription at a time.
Thanks in advance.

Because of the way eth_subscribe is implemented, that isnt possible without creating a new subscription. Could you explain your use case and why you would want to limit this to just 1 concurrent subscription? Maybe we can suggest an alternative approach.

Well the thing is the user interacts with a lot of contracts and the more he interacts with the app more contracts could be found (thus requiring to update the subscription), originally I was going to create a subscription per contract, but this quickly reaches the limit of connections, so I had to do a centralized entity to handle the subscriptions. that’s why I wanted to keep just 1 subscription, because the only way I see it possible by using more than one subscription is to basically have a pool of subscriptions that are waiting to be merged, and when they are finally merged into a subscription they are remove them from the pool and unsubscribed. it would work, but I wanted to see if there was a built-in way to handle it before implementing it that way.

Thanks for the context. It might be more efficient for you to subscribe to all logs per block and then filter client-side. That would be the most efficient way to get that data over the wire. Would that work for your use case?

Well I just tried the approach I mention and it’s working, I’m not sure if subscribing to all logs would be the more efficient since we’re talking about mobile devices, another questions that I’d have would be how do web sockets interact with the request limit? is the handshake the only one counted as a request? because if it’s not connecting to all events is not going to work.

Glad you got it working. And yes, the subscription counts as one request.