IM Transaction Management
March 19th, 2008One of the hard problems to solve with onesoup integration into the native messaging protocols is ensuring messages are actually displayed to the user.
The problem that exists is that onesoup acts as a gateway to the phone, but also as a client to the messaging network. To the network, once a message gets delivered to the client, it has been displayed.
Well, not always. XMPP is the exception and it provides extensions to differentiate between “received” and “processed”. A message might be received many times, but it will only be processed once. IMPS also provides similar acknowledgement capabilities, which are very necessary given the nature of the network. But since this is an “extension”, a draft, to the protocol, we can’t rely on it. Gtalk for example does not use it.
But the problem comes with Yahoo!, AIM/ICQ and MSN (and XMPP until such extension is supported). None of these protocols support transactions, so once onesoup consumes the message, even if the user has not seen it yet, the message won’t be redelivered. Why is this a problem? Let’s use AIM for illustration purposes but this really is the same problem across all of them.
Suppose an AIM message gets delivered to onesoup. AIM will then remove the message from their IM server’s archival offline storage (if the user has one). If the phone fails to pick up the message for whatever reason, and then the user connects via desktop client to the proprietary protocol, the message will be waiting at onesoup. The only time the user will see it is when he or she sign back into onesoup.
To avoid this behavior I am planning to implement at least a couple of features. One is necessary to support the IMPS specs anyway, but the other ones will be an alerting system:
- The spec provides a so-called TimeToLive or KeepAlive, basically the time that needs to pass without any client request for the server to be able to evict the session. It is during this time, until the session times out, where there is a problem of receiving messages and not being able to deliver them if the client has, for example, gone off the cell network. If the KeepAlive setting is too low, besides unnecessary data transfers, one risks frequent disconnections and reconnections, but the chance of messages being kept in the onesoup message store is lower.
- The spec also defines a TCP channel for the server to notify the client that there are messages to collect (CIR). One possibility to limit the risk of storage of undelivered messages is evicting the session if such socket is closed on the client side, and obviously, close the connection to AIM, etc. On cases where the cell phone is re-allocated an IP by the operator, this trick basically means that the phone will need to re-login. But I think this is acceptable, since such behavior is happening daily in our desktop clients due to firewall rules.
But even these two tricks are not enough. If the socket is not closed, there is no guarantee that the client will come to pick up a message after it being notified via CIR. Additionally, not all phones support CIR, so such mechanism won’t work too well for them. But for most phones it should work, assuming the clients behave well-enough to poll right after receiving the CIR.
Ideas or comments appreciated. Should we lower the KeepAlive at the cost of higher data transfers but lower risk of messages sitting on onesoup undelivered?
