We don't provide total number of rooms in ListRoom API from Chat SDK. However, you can load the list room based on the page (pagination) and keep load to the next page until it returns less than value of the limit parameter or return empty value. It is common for chat platform to load during scroll to see the next page of rooms, hence you don't usually need max page room number.
In the case that you really need pagination in the app, we can suggest several techniques :
- Load max value of limit of list room on the initial page load. For example you able to get 100 rooms by this API. Means that you have more than 100 rooms in your list.
- In the screen, you actually only need to show 10-20 rooms. Hence, you can put in your app 5-10 pages long, and then triple dot to show that user can continue go after 5-10 pages and can get still more rooms after that.
the other technique will be :
- Load max value of limit of list room on the initial page load. For example you able to get 100 rooms by this API. You will want to call this API several times (2-3) times to get few more hundreds room and eventually found max page for the users.
also you can do :
- Store the user-room relation in your own database every time user join any room, hence you can fetch the number from your own database.
Hopefully these tips can help you!