These are my notes from Substack's talk July 2, 2012 at NodeConf. Much of the talk was demo/code so these are pretty short!
I'm calling this talk Things Which Are Relevant
Node is kind of a big deal lately. You're all here about it, and I like to think of it as a turtle strapped to a V8 rocket. But that's not the real picture. It's more of a thermonuclear explosion going off, and the reason has to do with npm.
Npm is basically like the replicator from star trek. There are 12,000 modules in npm and there are a lot of modules like this. You think about all this value being created on npm. What if we could use all the value of npm, but in the browser? Unfortunately, there are browsers! They are awful and so terrible in so many ways.
I wrote this thing called browserify and I keep maintaining it for some reason. So how do we write something in browserify? It's actually really easy. You just write node-style code with requires. You can actually use the same code and use npm and handle all the requires and dependencies, except with the browser tacked on.
My favorite part of node besides npm is streams. Streams let you separate I/O in a really nice way. I took a project called dnode and cleaned out the code and made it stream-able. pipe() is amazing! You just use it, you don't have to think about it very much.
I took socks.js and wrote a 30-line wrapper to make it a Stream API. What kind of crazy mad science can we do here? There are some interesting things. When you use Stream instead of those other libraries, you can do interesting things. For example, I can put multiple streams into a single stream. We can take dnode and set the meta to tell what type of stream you have.
Socket.io is a great place to start. But if we try to re-think these abstractions, it shouldn't matter where the stream is , whether it's in the browser or on the server or in socket.io. We should pick abstractions that don't have as many outside complications.