3
votes

Serious headaches, trying to get ejabberd to integrate into an existing Rails app to support the chat part. Hope anyone wich has gone true this could share some insights on how to best approach cause currently everwhere there are issues.

My goals:

1. Store all data in mysql database for easy backup for this I have setup mysql usage for ejabberd using the mysql drivers so far so good

2. Easy add and remove users from each others roster ( add and remove friend connections ) for this I have setup module rest and mod_admin_extra to be able to do restfull calls to ejabberd from the rails app. The ejabberd admin module allows to add and remove users BUT ( overflow: https://stackoverflow.com/a/5229902/355281 ) This author says its not possible to store data in mysql Mnesia is always used by mod_admin_extra

3. Temporarily add users to each others list or preferrable have some temp room to add 2 users to so they can chat as long as this group exists. No idea how to approach this

Problems with all this

  1. Seems not all data can be stored in mysql, so data shattering Mnesia & Mysql , very bad to have data in 2 places and be unable to easy backup the mysql database
  2. Have to use rest module to do stuff to the database wich is on itself fine, but how to add 2 users to each friendlist is unclear to me.

Although ejabberd seems to be the most complete out of the box xmpp server I might need to look for another server that tackles above issues. This part of my project has been big headaches hope someone can clarify, provide some suggestions on how to approach.

for example:

  • If facebook used ejabberd how did they tackle these issues?
  • Is there a clean rewrite of ejabberd that tackles above problems? perhaps a commercial xmpp server with decent api and ways to add/ remove users and store data in 1 central location?
1

1 Answers

2
votes

Since you're already using MySQL, you can just manage the roster using Rails/MySQL Directly. If you don't wanna do it directly in the DB, which is totally understandable, you can connect to the server through bosh (http://xmpp.org/extensions/xep-0206.html), where you can do all you're asking for. There is a JS bosh client that you might be able to use as a guide to implement it in Rails, it's called http://strophe.im/ Regarding having the data in two places, you should have (or be able to have) all the roster specific tables in MySQL, additionally you can configure pretty much every persistent piece of data to be on mysql, I'd need to know more about your specific concerns and configuration to be able to elaborate more on this though. eJabberd is highly configurable and extendable, in my experience (over 8 years working with eJabberd) you can basically achieve any kind of behavior one way or the other.