A few days ago a small team of SoundCloud developers (@goldjunge, @jberkel, @purzelrakete and @sohm) participated in the first node.js knockout competition. Aptly named “Team SoundCloud”, we set out to explore the current state of server side Javascript using node.js and the real-time web.
(For those unfamliar with Node.js, head over to http://nodejs.org/ or the project wiki at https://github.com/ry/node/wiki for an introduction.)
The node.js Knockout is a competition inspired by the popular Rails Rumble. The rules are simple: Teams of up to 4 people have 48 hours to build a web app that is awesome enough to woo the judges and results in as many votes from the audience as possible. To level the playing field, each team was required to deploy their application to a dedicated hosting environment provided by either heroku.com or joyent.com…
If you’re a JavaScript head, we’ve got something for you. SoundCloud now supports Cross Origin Resource Sharing, using XMLHttpRequest. Or, to put it another way: no more implausible JSON-P hacks.
Some background on CORS can be found here and here. Our implementation is super-simple: we let you do GET requests, for our public resources. Full documentation of the feature is on our wiki, but here’s a bit of code to get you started:
var invocation = new XMLHttpRequest();
// Internet Explorer uses a propritary object called XDomainRequest
var url = 'https://api.soundcloud.com/tracks';
function callOtherDomain() {
if (invocation) {
invocation.open('GET', url, true);
invocation.onreadystatechange = handler;
invocation.send();
}
}As we’re just setting headers, the implementation was done as an…
Our very cool devs Matas and Hannes.
With over 15 developers working on the SoundCloud site nowadays, we’re pumping out a steady stream of new features and scalable web application code. It’s been a long journey building up such a great team, with lots of lessons learned along the way. We’re really thankful for the fact that the web startup community is so open about sharing technical knowledge–this has been super-helpful for us sofar. And we’re still regularly checking blogs of peer companies…