Server presence with openfire

as per the BOSH life cycle in smack-bosh

if I set setSendPresence(true)

The client API sends this after anonymous login

 <body sid='dab0f371' rid='8310002093709739' xmlns='[http://jabber.org/protocol/httpbind](http://jabber.org/protocol/httpbind)'><presence id='kqIoz-5'></presence></body>

Will the server respond back with a or simply ignore it??

See: Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence

The user’s server MUST also broadcast initial presence from the user’s newly available resource to all of the user’s available resources, including the resource that generated the presence notification in the first place.

I have noticed that this broadcast from server is not stable in openfire 3.9.3

either the server responds back with a lot of delay and gives an empty <body xmlns='http://jabber.org/protocol/httpbind’/>

sometimes the server responds back with presence if I send a duplicate presence with ack=’’

sometimes the server does not responds for the duplicate presence at all

should I wait for the first presence broadcast or go for a workaround

It is very difficult to treat the empty body response which might be received multiple times throughout the connection life

It’s supposed to be resolved with Openfire 3.9.0:

OF-454

but appearently it isn’t.

it seems if I send a second presence using conection.send() function

the response comes after 1 minute which is too much delay due to the HTTP POST server processing

I found a workaround

send 2 presence at once

then response comes immediately …

may be we can temporarily fix this issue at

line 549 Smack/AbstractXMPPConnection.java at master · igniterealtime/Smack · GitHub with a PlainStreamElement

otherwise we should not put setSendPresence(true)

then we can send the dual presence in our own code inside the ConnectionListener.authenticated

I’ve looked into that issue and I am pretty sure it’s an Openfire bug.

I’ve created a PR for a potential fix, maybe you like to review it and/or even test it, if you are able to test Openfire beta versions:

Send initial presence to the generating resource. by sco0ter · Pull Request #197 · igniterealtime/Openfire · GitHub