connect to push or api servers across subdomains
JavaScript CoffeeScript
Switch branches/tags
Nothing to show
Pull request Compare This branch is 8 commits ahead of jonashuckestein:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

MAIN TODO: improve this readme. For the moment, you're better off reading the sourcecode of

WARNING: there may still be some custom-to-us parts in the code. Feel free to tinker.

What is this?

Hadoken makes your node.js REST and/or push (via API available on subdomains and as soon as I get to it on other domains.

Just create your server like you normally would, then call hadoken.listen on it with the appropriate options and suddenly you're serving an xd receiver iframe and a bunch of javascript from your server that just works.

Currently there's a dependency on connect servers because I was lazy, so keep that in mind.

Here's a really quick example (pardon my coffeescript):

Server on

server = connect.createServer '/sayhi', (req, res, next) ->
  res.end 'hi'

  baseDomain: ''
  server: server

server.listen 80

Client on

<script src="" />
    url: '',
    success: function(){
  // if you set enableSocket to true when calling hadoken.listen
  // you can also get a handle on a socketio connection using
  // hadoken.socket

The client uses a patched version of the reqwest library but that may change soon


I initially wrote this to pull out a push server from our API server to separate concerns better. Then it occurred to me that this could be used to public API-ify random webservices and that's awesome. Like I said though, cross-domain is not implemented yet.

At campfire labs using hadoken allows us to serve all functionality (push, api, static file serving) from one process in development and from three different processes in production. It's pretty sweer