Tue 11 Sep 2012 3:51PM

Eventmachine for SSE and XMPP?

FS Florian Staudacher Public Seen by 66

Florian Staudacher Tue 11 Sep 2012 3:51PM

I have been busy reading up on event-based server architectures (Node.js, Python Twisted, Eventmachine) and now I am wondering, whether it would make sense to base stuff like live-updating the UI and XMPP chat on Eventmachine (since we already got that gem as dependency for Thin).
SSE (Server-Sent Events) are like Websockets, but they work only in the server->client direction. A big plus is that they're using the HTTP protocol. We could use that to get back what we had with websockets... live stream updates and notifications.
And XMPP chat has always had the problem of requiring a full-blown Jabber server (like ejabberd) and interfacing that with the user database. If we'd build a rudimentary implementation upon eventmachine and one of the XMPP libs for ruby, I think we could get far better integration while keeping the dependencies to a minimum.


Jonne Haß Tue 11 Sep 2012 4:00PM

Sounds good but maybe develop as much as possible in a separate library.


Jeremy Huffman Wed 12 Sep 2012 12:33AM

I would hate to create another run-time dependency, especially if it required you to pay for a whole extra Dyno on Heroku, that would really be a problem if the cost of hosting an entry-level pod goes from $0 to $35 just to support web chat.

I wonder if we could integrate pods into some kind of shared infrastructure for chat, so that not every pod would have to host their own.


Steven Hancock Wed 12 Sep 2012 4:48AM

I like the idea of using SSE, at this point it's more compatible than WebSockets for most of our hosting options and browsers (and there's a javascript polyfill to make older browsers compatible). I'm not so sure about XMPP, if it can be done without a separate Heroku dyno (or worse, a separate server environment just for XMPP) I'm all for it, but it's important to keep the cost and dependencies to a minimum for people who want to host their own pods.


Jonne Haß Wed 12 Sep 2012 6:03AM

What about providing tutorials on getting an XMPP account, maybe even host our own service for that, and then just use existing servers? Just a good and tight integration of existing XMPP accounts anywhere could be an approach.

Most likely we would either need BOSH with CORS enabled on that servers or provide some kind of proxying for that.

Just an idea.


Steven Hancock Wed 12 Sep 2012 8:04AM

@Jonne I like that idea, it's just a matter of finding XMPP services we can use.. preferably something that either integrates with Diaspora (so your login is the same, like Facebook or Google chat) or provides some form of authentication that doesn't require a pod to store username/password in plaintext. Several months ago I saw something that looked promising, someone was alpha testing a possible Heroku addon called Rabble.im that would have provided a hosted ejabberd instance with an API we could integrate with.. but sadly, that disappeared before it ever got out of alpha.