I was playing with building an XMPP bot at the weekend. The trouble was my google talk account, but it’s part of google apps for your domain. Why does this matter? Take a look at my ID:
dom@gapps.mydomain.com/Work
When you feed this to an XMPP library (xmpp4r-simple in my case), it attempts to find a server located at gapps.mydomain.com
. Which isn’t correct, my server is talk.google.com or somesuch.
But there’s a get-out clause in the spec (RFC3920).
Client-to-server communications MUST NOT proceed until the DNS hostname asserted by the server has been resolved. Such resolutions SHOULD first attempt to resolve the hostname using an [SRV] Service of “xmpp-client” and Proto of “tcp”, resulting in resource records such as “_xmpp-client._tcp.example.com.” (the use of the string “xmpp-client” for the service identifier is consistent with the IANA registration). If the SRV lookup fails, the fallback is a normal IPv4/IPv6 address record resolution to determine the IP address, using the “xmpp-client” port of 5222, registered with the IANA.
So, all it takes to get this working is some DNS tomfoolery. I added this to the zone file for mydomain.com
1:
_xmpp-client._tcp.gapps IN SRV 5 0 5222 talk.l.google.com. _xmpp-client._tcp.gapps IN SRV 20 0 5222 talk1.l.google.com. _xmpp-client._tcp.gapps IN SRV 20 0 5222 talk2.l.google.com. _xmpp-client._tcp.gapps IN SRV 20 0 5222 talk3.l.google.com. _xmpp-client._tcp.gapps IN SRV 20 0 5222 talk4.l.google.com.
Where did I find this information from? Well, it wasn’t on google’s help, but the DNS can tell me. There’s no XMPP server on gmail.com, yet you can still use your gmail address as a JID.
host -t srv _xmpp-client._tcp.gmail.com
Now I can sign on as dom@gapps.mydomain.com
ā lovely!
1 The privileges of being an ex-sysadmin. š
2 replies on “google talk for google apps users”
It’s documented, it’s just easy to miss. Go to the domain admin page and click on chat settings. It says “[t]o let users chat outside the Google network, you will need to edit your Service (SRV) records in domain settings” and then links to http://www.google.com/support/a/bin/answer.py?hl=en&answer=60227
@scott Thanks, but that’s subtly different. That’s about server to server communication, not client to server communications. Of course the only reason I know this is that I found that page, tried it and it didn’t work. š