your server is for example server.com
Every component/gateway you plugin in the server runs on another domain or subdomain. So when you install the sms gateway it will run for example on sms.server.com, a weather component could run on weather.server.com and a MSN gateway on msn.server.com.
If you send a message to a Jid xyz@sms.server.com then the server knows that this message belongs to the component and routes it to your component.
And its the same for the client. If you discover the server on login and all its components then your client knows if a incoming message is from a contact, mobile phone (sms), weather broadcast service or whatever.
If your client talks only to your own server then you can also hardcode the domains.
Software Developer
AG-Software