Hi,
I am trying to create a XMPP bot, and I have read the extremely helpful article on "thoughts on XMPP bots". The stanzas update will eventually be the Achilles’ heel when the user base increase. With a XMPP bot, I would like to know who has subscribed to the bot, but I can always store the users in a separate database. So, it seems that a component bot is a logical choice. But my question is, initially, if I implement it as a client bot, I would ask users to subscribe to say, "movies@hip10.net", but I notice if I would like to migrate to a component bot later on once the no. of users increase, I would have to create something like "movies@movies.hip10.net", so which means the users will need to add a new bot, instead of just using the previous bot.
Is there any way to ensure the migration is totally invisible to the end-user in the future? Or that we have to set it up as a component bot from day 1 to avoid migration issues in the future. And another question is that the component bot requires that we set a listener port, that seems to be different from just creating a simple client bot, which do not require defining of a port, is that right?
If we add more and more component bots in the future, do we need to shutdown ejabberd and restart the server every time there is a new component bot?
thanks,
Dicky
No need to restart
If we add more and more component bots in the future, do we need to shutdown ejabberd and restart the server every time there is a new component bot?
In ejabberd, a component is managed by an ejabberd_service listener. Listeners in ejabberd are either defined in ejabberd.cfg, or started using the ejabberd Web Admin. So no need to restart: you can add start components, and add ejabberd_service listeners using the Web without restarting ejabberd.
client subscription
Thanks for the reply. But in the case of the client, the user will need to unsubscribe from an existing client bot, and subscribe to a new component bot since the address is different, right? E.g. client bot=>movies@hip10.net, component bot=>movies@movies.hip10.net (assuming that one server can host multiple component bots, which means that we need to distinguish via subdomains, right?)
The bot can send unsubscriptions, and later subscriptions
Thanks for the reply. But in the case of the client, the user will need to unsubscribe from an existing client bot, and subscribe to a new component bot since the address is different, right? E.g. client bot=>movies@hip10.net, component bot=>movies@movies.hip10.net
Yes. There are two ways to alleviate the migration for users:
A) Before stopping the old bot, it could send unsubscription notices to all his contacts. Later the new bot could request subscription to those users that you know are interested in the service. To know how to implement this in your bot, you can check XMPP protocol documentation, and your XMPP library.
B) If all the users of your bot are in your Jabber server, you could modify the roster items stored in the database, changing the JIDs of the old bot to the new bot. This would require understanding the format of the database tables, and the format of ejabberd database is not documented.