Openfire Integration with existing web site in PHP


I am completely new to openfire/ jabber domain. I want to provide a chat feature to an existing web site.

What are the steps, architecture etc to get openfire working for an existing site? Is there a document that can provide a tutorial for the same?

Some of my questions/ requirements:

  1. User/ group data - there is a mysql data that has information about users, and then another table that has information about which users belong to each group. I need to create chat rooms for each group. I think this can be handled by using the class mentioned in the documents that connects to a SQL DB. Or may be write my own class implementing the same interface.

  2. Client - I need to write AJAX client, with custom UI. Are there any tutorials/ customizable software available? I think I should be fine with API document that ajax needs to call from browser.

  3. Logging in - when a user logs in, the web site issues an auth token that is stored in the cookie on browser side. How can my ajax chat client pass this authentication token back to chat server to avoid authentication each time? I would not like the PHP code to broker each and every request from client to the chat server. Instead, it should get the handshaking done on logging in, and then move out of the communication. Is it possible that web server continues to issue token as it is to the browser - and ajax client sends back requests to chat server with that cookie, and then chat server connects back to DB to validate the token - if the user is not already in the chat server’s cache of authenticated users. If the user is already in the logged in cache of chat server(and the token sent is correct in each request) - then the chat server does not go back to the DB, and honor the request from the client.

  4. New users - I think whenever there is a new user registered, joining/ leaving a group etc - it will go to my existing DB. There should be no extra integration required except that mentioned in point 1.


Openfire can leverage custom “external” databases, so that should be no problem.

As for your client- there are a few existing ajax clients out there you might look at, but nothing (released) from this community. JWChat is one Ive used, but I cant speak for the customizability of it.

The custom auth bits are a little more tricky. I know at least one other company has implemented a login scheme as you describe, but it was never fully released as much of it was very specific to their own application. I suggest implementing your own SASL mechanism, then making sure whatever client you develop understands that mechanism. It might be possible to do this as a plugin, but it very likely could mean customizing Openfire. If you have more questions on this topic, the Openfire Developers forum is a better place to ask.

Thanks SP for your quick response.

Question to all - Are there people who have integrated openfire with their web sites? How have they implemented it?

What are the sites running this server and what kind of load etc are they able to take?