when the Openfire display online，but the client is offline unexpected in fact.in this case, message send to the client will miss.what is the problem?
The problem is that your sessions are not closed properly and hang on the server, so Openfire thinks it is still online and delivers the message in to the void.
One thing you can do is to create/modify a system property xmpp.client.idle and set it to some low value. E.g. 10000 (it is in miliseconds, so it will be 10 seconds). this will close idle sessions after 10 seconds idle time. But you should watch you clients and choose the most comfortable time period for this. because if you set it too low, it can make you clients reconnect sporadically.
Other options and not available at the moment. There is a XEP standard (Stream Management) for handling situations with connectivity loss, which can helpwith this situation a bit. Not implemented in Openfire yet. And there is a client feature - Message Receipts. Which in this case will inform you, that a contact hasn’t reported, that a message has been received. This has to be implemented in a client. Spark doesn’t have this implemented.
thank you 。but i do not think setting xmpp.client.idle will resolve the problem absolutely。othewise, the low value will increase openfire server load ？
Yes, it won’t fix the issue, but will make it lss possible to happen. Not sure if this will generate more load on the server. Some clients will reconnect immediately and this will take some server’s time. On the other hand you will get rid of idle sessions eating your memory.
why not openfire resend the message when sending message failed?
There is no mechanism in Openfire to notice that message didn’t get through. Openfire just checks if session is online and sends the packets. It doesn’t wait for the acknowledge from the receiving part. XMPP in its core is a very simple protocol. To provide a reliable communication there are additional standards that exist in the protocol, like Stream Management http://xmpp.org/extensions/xep-0198.html
But this is an additional functionality that can be implemented by xmpp server’s (in this case i think a client should also support that) developers. Openfire doesn’t have this implemented. Though it is a some what desired feature, but rather complex, and given that Openfire is a project without full time developers team it is hard to tell when and whether it will be implemented. https://community.igniterealtime.org/message/210575#210575