client using Spark and server using Openfire are not in LAN, i dont’ know whether the client can connet to the server
It can. You need to give it a fully qualified domain name, a dns entry and open the ports needed to allow connection. THere are many other posts discussing this. You may be more interested in fastpath though.