title: Using ejabberd with Rails
body: <p>I'm trying to create a chat component to add to an existing Rails web app (and perhaps optimize communication with clients along the way). The architecture I was thinking of is: when a user authenticates on Rails, create his/her Jabber credentials and set them in JS on page load. Use ejabberd to accept flash TCP or BOSH (probably using <a href="https://github.com/ssoper/jquery-bosh" rel="nofollow">jquery-bosh</a>) connections from clients, connect Rails to ejabberd (as a regular client) using xmpp4r and look at messages from clients as they come. If they're app-specific messages, do the relevant action, if they're user-to-user messages, pass them to the appropriate user/group. At the same time, continue to use Thin/Apache to serve the regular webpages.</p>
  
  <p>I have a couple of questions:</p>
  
  <ol>
  <li>Does this architecture make sense or is there something in it that's not doable?</li>
  <li>Besides the ejabberd documentation and xmpp4r documentation, which I'm currently going through, are there any other resources you could point me to that might be of interest?</li>
  </ol>
  
  <p>Thank you.</p>