JS.Class and Helium updates

Just a quickie to let you know I’ve pushed out new minor releases of JS.Class and Helium tonight. The updates in JS.Class 2.1.4 center around a totally rewritten package manager that uses an event cycle to trigger dependency downloads instead of polling packages to find out when they’re ready to load; this should make a little more efficient. I also managed to remove JS.Package‘s dependency on the core, meaning the package loader is completely decoupled and much smaller, coming in at a measly 2.5kB when gzipped. Should shave a few milliseconds off your load time.

Helium 0.1.2 improves its handling of how branches and tags are mapped to commit IDs, so it can cope with multiple heads referring to the same commit and should always pick the latest commit from a branch correctly. Do let me know if you find bugs in either.

Faye gets server-side clients

After its initial release a few weeks ago, the number one feature requested for Faye has been server-side clients. The first version let JavaScript running in the browser send messages, but now you can create a client on the server side to let your backend applications subscribe and publish messages. We’ve got clients for Node.js and Ruby, the latter requiring EventMachine.

Both environments can use ‘local’ clients, that is clients in the same process as the server, and remote clients that connect via HTTP. For example, under Node.js:

// Remote client
client = new Faye.Client('http://example.com/faye');

// Local client
server = new Faye.NodeAdapter(options);
client = server.getClient();

The client works exactly the same as the one you’ve been using in the browser; indeed it’s the exact same class with some different adapters to handle Node’s HTTP APIs. Under Ruby:

# Remote client
client = Faye::Client.new('http://example.com/faye')

# Local client
server = Faye::RackAdapter.new(options)
client = server.get_client

EM.run {
  client.subscribe('/from/*') do |message|
    # do something with message hash
  end

  client.publish('/from/jcoglan', 'hello' => 'world')
}

There’s also been a bunch of bugfixes, and the Node bindings have been updated to run on the latest node release (it should run under 0.1.29 and 0.1.30 as of this writing). Grab it on RubyGems.org or from the GitHubs.