I'm not sure what the current status is of the BOSH termination flow. It seems the XEP hasn't changed though, so I thought I'd throw in my latest experiences.
Prosody was replying to the eldest held request with a type='terminate'. The XEP technically doesn't specify *which* request the terminate response should go to, though I'll admit that on a surface reading it seems it would imply replying to the latest request. This leaves open the question of what to do with older requests, it also breaks the overall BOSH principle of replying to the eldest request first. Prosody's behaviour didn't properly deal with the last request (which is the one that had type="terminate"). I've now changed it so we have the following behaviour, which seems to work nicely with both Strophe and JSJaC: - On receiving a terminate request, set a temporary flag on the user session. - Handle any stanzas in the request, if we send any stanzas in response to these (e.g. unavailable presence), the generated BOSH responses will include type='terminate' (determined by the flag on the user session) - this is a helper to indicate to the client it shouldn't open a new request after this response. - After all processing has been done, close any requests that are still open (again with type='terminate'), and finally the request that initiated the termination, as in the XEP. The reason for including type='terminate' as a rule on all post-termination-initiation (!) responses is that in the course of replying to the stanzas included in the termination-initiation request, we may actually reply to that request with stanzas (e.g. if it's the only open request). This avoids special-casing the last ppen request during termination. If the above isn't clear enough, let me know :) Regards, Matthew
