centrifugal / centrifuge-swift

Swift client SDK for bidirectional real-time communication with Centrifugo and Centrifuge-based server over WebSocket
MIT License
47 stars 41 forks source link

Batch Subscribing #52

Closed onato closed 2 years ago

onato commented 2 years ago

On one of my screens, I subscribe to a large number of channels. Currently, this means an HTTPS request for each subscription.

I noticed that the JS library supports batch subscriptions. Are there any plans to implement this here too?

FZambia commented 2 years ago

Hello, I think you can do batching yourself by implementing it on top of existing onPrivateSub callback. I.e. have a way to merge individual callbacks together and issue a single HTTP request for tokens (using explicit signal or by time/size).

Maybe this entity will be generic enough and so that we could include it in centrifuge-swift core eventually, like a separate helper.

onato commented 2 years ago

Quite right, I'll do it in my code for now and submit a pull request if I generalize it enough to be useful to others.