-igal
Jesse Hallett wrote:
> Just a reminder that our next JavaScript meeting will be Wednesday
> night - tomorrow - at 7pm at Jive Software <http://calagator.org/>.
> The topics for this meeting are:
>
> * node.js - evented I/O for JavaScript on the server <http://nodejs.org/>
> * Google Closure Tools - everything you need to build a Google-class
> web app <http://code.google.com/closure/>
> * Testing asynchronous code with Screw.Unit and Blue Ridge
> <http://github.com/relevance/blue-ridge>
>
> Bring a laptop if you have one. This will be an activity night.
>
> There will be pizza, kindly provided by Jive Software. Plus we will
> have essentials on hand for celebrating the JavaScript Admirers' first
> birthday.
We use eventmachine on the server side to power this whole concoction
and a number of other messaging systems, such as launching new game
servers on other machines and relaying game allocation information back
to the user.
Anyhow, I came up with a little strategy to intertwine our push messages
and our rails app to provide a cohesive interface by effectively turning
the user's web browser into a 'controller', making the push server the
'model' and rails controllers the 'view'. The results in development
have been very encouraging and we should have this in production once
another project wraps up.
Basically, our event machine process delivers JSON to a publish endpoint
of the nginx comet implementation, which then pushes it to a subscribing
XHR client. The client then interprets those results and requests
another piece of data from the rails server which is then rendered in
the place the push message describes. This allows effective multiplexing
of push operations over a single subscriber, and doesn't require us to
write application code specific to our push implementation (we just
write it for our main rails site).
I've been given permission to create a presentation+demo for the
philly.rb guys (living here now, but still like having my ear on this
list), so I can share this.
The presentation isn't done yet, but here's some javascript to chew on:
You may also want to look at my patches for nginx_push, which make the
server CORS (cross-origin spec for HTTP, supported by everyone but
opera) compatible. The original maintainer says they're going to be
merged soon.
http://github.com/erikh/nginx_http_push_module
Anyways, I just blurted this out because it seemed like it'd be
interesting to people who found those topics interesting, as they seem
to be closely related. I'll blurt again when the demo's done.
-Erik