Instead of going to hell, as suggested in your comment above, I’ll provide you an approach.
Create a server-side component. Your client sends it some protocol (such as XEP-0050) and the service sends your client an invite to the correct room. If you want existing clients to be able to join, also accept a plain text message.
The component will need to join each room to keep track of the number of participants using their presence. As such, just have the component create each room as needed, before inviting any participants.
solved controlling the number of chatroom users in xmpp server [closed]