Indeed so. I thought that I had my answers because if the timing, Janet sent me a 7MB .MOV file from iPad to iPad over iMessage and the time taken seemed consistent with a bottleneck caused by the 1.1Mbps upstream of our internet connection.
There is an alternative Apple file transfer application called Airdrop that will find a user who is physically close. I think a Bluetooth broadcast is the method by which the recipient is identified initially, it doesn't use usernames or domain names or any such. Many iDevices have stupid hostnames anyway such as just plain "iPhone". This is either because users either never get around to setting them or else they have very little imagination if they do and even then there is no chance of the global uniqueness that would be needed but which is found in FQDNs.
Airdrop I believe does the right thing though. Which just shows the madness of iMessage. Why in any case would Apple want that unnecessary extra traffic going through their core network ?
I wonder if I could work in them and persuade them to fix it. It would take about a day or so maybe? Hopefully a lot less with someone who really knew what they were doing.
I wonder about an alternative method, where you just always use IPv6 link-local addresses only. If you don't have one, then you can soon make one and just try pinging the other end with it. It doesn't matter that you cannot test for the two ends being on the same network, because you just go for it, send the other end a query using UDP to ask its identity and it either works or it doesn't in which case you go back to plan B. That might be faster and possibly less code than going to the servers to find out addresses of the other end, waiting for the replies and so on. If iOS devices always have IPv6 link-local addresses in every single case, even when they have no IPv6-speaking router, nothing announcing an IPv6 prefix, then in that case this method is really convenient.
One other thing. In case you are on a WLAN that is set to isolate stations from one another and allow them internet access only, you would have to allow for that cause of failure and fall back to the horrible two-sides-of-the-triangle method that we suffer now. Guests are set up like that on my WLAN. The straight-to-link-local method does this test immediately so that is another advantage of going that way.