Sorry for resurrecting this old thread, but I wanted to address this: > Oh, I understand now. Of course real life experience is much more valuable. > Openfire's approach to situation is also related to in-order message > forwarding I described above. When 'requests' attribute is equal to 2, the > server can expect requests with lastRid + 1 and lastRid + 2. At any time, if > lastRid + 2 is recevied, the server can only expect lastRid + 1. If lastRid > + 3 is received, it means that the request with lastRid + 1 is lost > somewhere or never sent at all, so the client's session will be dropped with > 'item-not-found' error.
This solution is not ideal. Why terminate the client for transient HTTP or connection errors? Instead, if you get lastRid + 3, immediately time out the lastRid + 1 request and resend it. This will let you recover from the error gracefully. You need this kind of graceful but prompt recovery because these transient errors are quite common. User's are going to be very frustrated if their BOSH sessions often and suddenly. In Strophe.js we use two timeouts for this. The normal timeout is approximately wait + 7 seconds, and triggers whenever we've waited that long on any particular response. The second timeout is 7 seconds, and it starts whenever we senda new request until the previous response is received. For hold=1, this works because as soon as we send a request when there was a previous request outstanding, we know the server must immediately generate a response. If we receive no response in a short amount of time, we can guess that it was lost somewhere, and must be resent. These graceful and prompt failures make Strophe.js extremely robust to various connection and HTTP errors. jack.
