google talk for google apps users

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:

When you feed this to an XMPP library (xmpp4r-simple in my case), it attempts to find a server located at Which isn’t correct, my server is 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 “” (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.com1:

_xmpp-client._tcp.gapps IN SRV 5  0 5222
_xmpp-client._tcp.gapps IN SRV 20 0 5222
_xmpp-client._tcp.gapps IN SRV 20 0 5222
_xmpp-client._tcp.gapps IN SRV 20 0 5222
_xmpp-client._tcp.gapps IN SRV 20 0 5222

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, yet you can still use your gmail address as a JID.

  host -t srv

Now I can sign on as ā€” lovely!

1 The privileges of being an ex-sysadmin. šŸ™‚

2 replies on “google talk for google apps users”

@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. šŸ™‚

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s