Vishwas Shashidhar
Vishwas Shashidhar

Reputation: 837

Recommended way to store chat history for a webapp

I'm implementing a web based chat client using Openfire API with Java.

Things are setup and running smoothly, however, I'm a little confused as to where to store chat history.

From what I've observed, Desktop based clients typically store chat history on the client side filesystem using formats such as xml, txt etc.

On the server side, I have the following options:

  1. Using plain text file
  2. Using json (mongodb, hbase etc)
  3. Using database

But I would like to know which is the best of the above options (or any other ones if you can suggest) in terms of speed and performance.

Thanks.

Upvotes: 1

Views: 1202

Answers (1)

fpsColton
fpsColton

Reputation: 873

As mentioned in isnot2bad's comment, you can add server-side message archiving through the use of the Openfire Monitoring Plugin. Once you have that setup you can try using the XEP-0126 to fetch archived 1-to-1 chat messages over XMPP.

Openfire Plugins

Unfortunately I have had nothing but trouble when trying to get messages out of the archive using the stanza's defined in XEP-0136. If you look around the OF support forum you will find other people are also running into problems with this plugin. For example, the plugin will not return the list of conversations in correct order, it will not filter the list of conversations or messages by the date specified by the start attribute, etc. To say the least, the plugin could use some work. As a work around, I've left the plugin in place to take care of inserting the messages into the database, but I've written a custom AJAX solution for the retrieval of the archived messages. I just pull them directly out of OF's database and return them in a JSON object to my client side javascript.

XEP-0136 is due for replacement, it's always been overly complicated. XEP-0313 seeks to replace it, but I haven't found any implementations for OF. Good luck.

Upvotes: 1

Related Questions