Closed marcphilipp closed 6 years ago
From pubsub service point of view, it would cost waiting for initial user presence, requiring some dedicated state in c2s, as we don't want to trigger this on every presence packet. Waiting for 'initial presence' would also make mandatory for a bot listening to pubsub headlines to send presence, which makes no sense in this situation. For these reasons, as soon as session is alive, pubsub will send you the last items. This is an implementation choice. I don't see what you mean by "client may not be ready". if your application needs to have sent presence in order to handles messages, then you can still stack messages you receive until your app is ready to process them, no ?
At least with XMPPFramework on iOS this completely breaks connecting. The workaround is to manually disable establishing a session (urn:ietf:params:xml:ns:xmpp-session) entirely: https://github.com/robbiehanson/XMPPFramework/blob/157bcd1d595b284b1765ea607eddc3d5d4127d84/Core/XMPPStream.h#L239-L253
@weiss indeed using c2s_self_presence hook is the key, your patch looks good.
Thanks for the fix! 👍
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
17.09
CentOS
source
We're using PubSub nodes of type
flat
wheresend_last_published_item
is set toon_sub_and_presence
. When a subscriber connects, ejabberd sends the last published item immediately after resource binding. At that point the client may not be ready, in our case it is still establishing a session. Instead, ejabberd should send the last published item after the initial presence stanza.Here's our log:
As you can see from the log the last published item message is received before the result IQ of the session creation and before the initial presence stanza.