An XMPP domain is different from the hostname of the server that runs Openfire. They can be the same, but they do not need to be.
XMPP clients use DNS SRV records to determine what hosts can be used to connect when a user wants to log into an XMPP network.
Take, for example, user JohnDoe that has an account with the XMPP network “happychatters.com” (fictional - if this actually exists, that’s a coincidence).
Let’s assume that the happychatters XMPP domain consists of two servers (in a clustered setup):
happychatters should have set up various DNS SRV records, amongs which ones that allow clients to determine how to connect to the service (there ought to be more records, for server-to-server functionality, but that’s out of scope of this example). These could be the DNS SRV records that have been registered by happychatters.:
_xmpp-client._tcp.happychatters.com. 86400 IN SRV 5 50 5222 server-one.happychatters.com.
_xmpp-client._tcp.happychatters.com. 86400 IN SRV 5 50 5222 the-other-server.happychatters.com.
I won’t get into the nitty-gritty details of DNS SRV records, but this shows how the XMPP ‘client’ service for happychatters.com (first part of each record) maps to a port on specific hostnames (last part of each record). The other numbers in there are an indication on how weights and priorities should be calculated.
So, back to our client. When a user identifies itself as a user on the happychatters.com network (by using the Jabber Identifier firstname.lastname@example.org), the client should take the XMPP domain name, and perform a DNS SRV lookup. Based on the records above, it will find two hostnames, to which it can connect. That’s all to it.
You’ll find that DNS SRV records are not available for some XMPP domains. In such cases, clients typically fall back to the regular DNS records, and try to connect to a host that it finds through that. Lastly, most clients will allow users to define a specific connect host (which is typically part of an 'advanced configuration" setting in the client).