Care to share some of what you have done?
Sorry it took so long to get back on this.
After a few iterations we basically have an async activeresource.
Inside activeresource we spin up a thread which opens a connection to
a localhost server and keeps the connection open across rails
requests, using a simple line based protocol. The localhost server
proxies the requests from activeresource into http requests to our
middleware. Since the localhost server uses Eventmachine, the whole
thing is asynchronous. For example, Person.find() returns
immediately, giving me an object that I can at any subsequent time
call a wait() method on when I need the results. Or optionally I can
just wait for Person.find() to return the result. It also lets us do
things like prefetch data for ajax requests that get called after the
page is loaded, etc.. We can also make activeresource calls in one
request, and then get the results in a subsequent rails request, by
saving query id's in the session.
I have permission to contribute this back as open source, but I need
another month or so of testing and adding a bit more abstraction
before I'm ready to release it. There are quite a few changes to
activeresource, primarily in connection.rb. I've also added in some
of the type checking/casting and validation helpers from activerecord,
and I'm working on some conventions for REST service discovery also.