The following are my notes from Node.JS Camp, which I attended with several other developers, and at which I had a lot of fun. For $35, I got two meals, a T-shirt, and almost a whole day of exposure to node, which I’d previously been keen on but had not actually worked with.
I tried to take notes on every presentation or workshop, but to tell the truth I wasn’t much good after lunch, as I’d not gotten much sleep the night before. These notes were taken using Simplenote on my iPad and Notational Velocity (a rad Simplenote client) on my MacBook.
Most examples we watched are available at https://github.com/joyent/node-camp.git
There seems to be an awesome collection of links on the camp site as well: http://camp.nodejs.org/resources.html
The morning started with a bevy of power issues from the daisy-chained strips, but this was settled before lunch. Wi-fi was very good throughout.
@ryah was up first with a great little demo, building a chat server and client in about 10 minutes. Hilarious as always, he discussed standard out using
console.log, the availability of
setTimeout in node, and talked about net and http modules.
Of interest was hearing that
require can take a version # if need be, but managing in package.json ensures existence of modules before runtime.
http.createServertakes a callback which itself takes request/response params, returns server object.
net.createServertakes callback with socket param
socket can accept events using
socket has properties such as
remoteAddress, etc for obtaining info about the connection
on()can take event names such as “data”, “end”
end event is useful for tracking data/cleanup
You must bind to a port before a server will continue running.
Concurrent connections are not a problem even out of box – maybe load issues?
Isaac Schlueter on npm – the node package manager
This presentation started slow but became interesting a couple minutes in.
npm can be used for handling dependencies for local projects, specifying tests, start scripts – all in package.json
start script is actually a line of shell command to run
Interesting commands: npm and various subcommands… ls, adduser, install, installed, publish, activate (jump to a version)
npm start loads dependencies before running start script from package.json
Next up was Guillermo Rauch (@rauchg) on express (billed as just routing in the agenda for some reason?)
This was a quite in-depth quick tour of Express. We built a blog app with express, using jade, and testing with Expresso was covered in brief, or at least mentioned. (maybe someone could school me on what went down when I had my head turned away)
express routes are like Sammy/Sinatra, using HTTP verbs with patterns to match
nextpasses on control to next piece of middleware
Jade is very similar to haml:
- allows filters like haml (markdown!)
- uses “-” to jump into js for condition lines etc, no blocks of js needed, just indentation
- no % before tagname (haml uses this)
- multiline text needs to be prefixed with “|” on each line (haml doesn’t need this)
- “=” will escape html
- “!=” will not
- jade has layouts, partials like Rails
thisrefers to app
Express routes receive params like Rails in
response.rendermethods, similar to Rails
“fs” module can be used for dealing with static files, has both sync and async methods.
Expresso comes with Express now (have I got this right?) You can use make to run tests? Comes with rcov-like tool called test-cov. Didn’t get much detail about this.
express command works similar to
rails command, generates an app directory, etc. Interestingly, you can’t use this outside an existing directory.
Tim Caswell (@creationix) was up next.
socket.io and the game client
Tim built a cool demo, the beginnings of a game, really. You can see it on https://github.com/joyent/node-camp/tree/master/hexes. He tried to bring some interactivity to the git-together (sometimes I kill me) by having people shout out ideas for games, etc. There were one or two volunteers with ideas, but mostly the room was silent.
People’s shyness (in large groups) seems to have kept them from participating much in sessions like this. (it certainly kept me from doing so…)
The main thing I got out of the talk was that socket.io (which seems freaking awesome) falls back to long-polling, Flash, XML request, iframe and maybe even more options if WebSocket is unavailable in the browser (should work everywhere)
Matt Ranney on Redis
His company is doing Voice over HTTP ha! Crazy right? He was majorly enthusiastic about Redis, I can tell you that!
Redis is “like” good for session, shared data across, “like”, many processes, great for when you outgrow one node.
Quick note: Ranney totally reminds me of Jeff Haynie. Not totally sure why. I was very happy to finally hear someone else pronounce JSON “Jason”! Go team. And stuff.
Ranney’s redis client ensures client requests finish in order, so you can embed a callback in only the last request(this is accomplished via combining all queries into one http request, piped together)
Redis is straight key/value, simple client (redis-cli) with GET/SET commands
special functions for pubsub, storing/getting entire hashes
harder to make work as primary db
I was glad to hear him speak about redis as a great tool while still mentioning its downsides.
After this we broke for lunch, and my note-taking and consciousness-maintaining abilities suffered noticeably. The following are my afternoon notes:
Cloud9 IDE with Rik Arends
Cloud9 is working on a potentially very cool product, an in-browser IDE along the lines of Bespin, or Palm’s Ares, but with maybe more possibilities in store.
Unlike Bespin, Cloud9 IDE runs on a node server instead of python, and it uses DOM manipulation instead of canvas. Supposedly, they’ve run tests and shown that their DOM stuff works faster.
There was also talk of the projects merging, though I’m not quite sure if this is more of a fork in the project or what parts of each project will remain.
Cloud9 has a full debugger, just like Ares. It has many keyboard shortcuts, including different ones between win/Mac. We were told the debugger in V8 provides most internal functionality.
The tabbed editor in Cloud9 looks kind of like the tabs in Chrome. It looks pretty good, but it was hard to make out much in my state while also taking notes.
Cloud9 will run locally, and eventually [the company] Cloud9 will be hosting projects, well, in the cloud, obviously!
Cloud9 [the IDE] already supports Textmate themes, and has some keyboard equivalents with that lovely editor.
Kinect driver for node? Demoed a live scan of the room using a Kinect sensor bar. “completely useless, but fun!” What, if anything, this has to do with the IDE is beyond me, but it was definitely fun. The Cloud9 guys have gotten WebGL working on the server side, rendering data live to the browser somehow.
The only hitch I remember seeing was a stop button that wouldn’t work, which Rik responded to promptly – “I do have to mention we’re beta”. And somehow, I was the only one laughing? No one has a sense of humor!
Realtime source editing – builds off V8 internals. This was slick, the browser demoing his server-rendered WebGL code showed a change in his code immediately after he saved the file, without having to reload the browser. Not really sure I understand what happened still, though.
Github account: https://github.com/ajaxorg/cloud9
Jslint coming soon, currently matches curlies
Autocomplete coming soon
Collab coming in the future… Great for pair programming
Local will continue to work well (open source), saas will focus on integration with other services etc
Works with git already
Ruby a next target language to code/debug against
@rauchg was up again to talk about socket.io, but by this point I was fading fast. I have very vague notes about pub sub in socket.io, but nothing worth repeating.
One thing that did break through my haze of sleeplessness:
Someone recently commented that Twitter IDs may be reaching a point where they’re too big for js to handle as numbers. Does this break lots of current js clients? Haven’t followed up on this just yet, but it was interesting.
That’s all I’ve got, I didn’t make it to the presentation on deployment. I sure wish I had!
Oh, and much of the event is or will be available online as videos for everyone at http://www.ustream.tv/channel/node-js-camp.
Thanks for the great day to everybody at Joyent and the other contributors and attendees, and thanks to @ryah for putting node out there!