I am facing the same problem, it only occurs with i devices, sometimes I can go through an entire session with everything sending instantly, sometimes I get a delay so large that I think the message hasn't even been sent, but after, sometimes almost a minute, a small package of 467 bytes arrives...
While researching this problem I can across this documentation: http://www.stuartcheshire.org/papers/nagledelayedack/ a bit old but interesting. It suggests that tcp likes to have a continues flow, and sending messages from time to time can cause problems, the writer suggests.
Quote from the link:
The overall summary is that many of the mechanisms that make TCP so great, like fast retransmit, work best when there’s a continuous flow of data for the TCP state machine to work on. If you send a block of data and then stop and wait for an application-layer acknowledgment from the other end, the state machine can falter. It’s a bit like a water pump losing its prime — as long as the whole pipeline is full of water the pump works well and the water flows, but if you have a bit of water followed by a bunch of air, the pump flails because the impeller has nothing substantial to push against.
If you’re writing a request/response application-layer protocol over TCP, the implication of this is you will want to make your implementation at least double-buffered: Send your first request, and while you’re still waiting for the response, generate and send your second. Then when you get the response for the first, generate and send your third request. This way you always have two requests outstanding. While you’re waiting for the response for request n, request n+1 is behind it in the return pipeline, conceptually pushing the data along.
I haven't tried this myself yet, but the info could hopefully help you or others.
Regards,
Beau
Edit
I have just tested while sending loads of (unless) messages every 0.05 of a second (overkill I know) and it seems to improve things, all the important messages that I send among the useless ones seem to be getting received instantly, I've only just tested for less than a minute, but it seems to make a difference