How can I rename a channel group? so that all the channels are retained as it happens?
Renaming a CG is not supported but would like to understand your use case for this better. Currently you just need to create a new CG and just add the channels from the old CG to the new CG.
In our case, CG is directly associated with user id of the user in the system. we have use case where user id would change in the system as user merges different account into one. I understand that by listing channels using channelGroupListChannels and then adding by channelGroupAddChannel them to a new CG would work. How ever its not an atomic operation.
"Renaming" was not an anticipated use case of channel groups.
The best way to go about doing this would be to send a REST request to your server that provides the new CG name and the old CG name. The server can add the channels from the old CG to the new. When this is completed, your server returns to the client "SUCCESS" and your client unsubscribes from the old CG and subscribes to the new. This would provide as close to atomic as possible and minimize chance of missing messages or getting dupes.
There might be some holes in this design but perhaps we can flush them out and strengthen it further.