If you don't have a concept with web chat, the best practice might be: Openfire+jsjac
OpenFire is a Java-made open source XMPP server, and Jsjac is an open-source, web-version XMPP client made by JavaScript.
- Open the HTTP binding and Bosh in the admin interface of OpenFire and open "in-band account Registration".
- Copy the Jsjac simpleclient.html and jsjac.js to the Resources/spank directory of OpenFire
- If your OpenFire HTTP port is open on port 9090, then access: http://192.168.0.100:9090/simpleclient.html
- On the page HTTP base fill in: http://192.168.0.100:9090/http-bind/, write a random account password, tick "register new account", you can register and log in.
- Do not check "register new account" When you log in later, so as not to repeat the registration.
It's so easy to build a web chat system.
PS: If you need to do follow-up development, then resource and mechanism such as XMPP-related knowledge is needed.