Real-Time Web with Node.js Real-Time Web with Node.js

Into Node.js

Kyle Simpson
You Don't Know JS
Check out a free preview of the full Real-Time Web with Node.js course:
The "Into Node.js" Lesson is part of the full, Real-Time Web with Node.js course featured in this preview video. Here's what you'd learn in this lesson:

Kyle sets up the scope for what will be covered in this course. He'll be focusing on three major topics: HTML5, Node.js, and WebRTC.

Get Unlimited Access Now

Transcript from the "Into Node.js" Lesson

[00:00:00]
>> [MUSIC]

[00:00:04]
>> Kyle Simpson: Let's jump into our discussion today, about node.js. Now I promised you yesterday that there's gonna be a lot more code and there will be. There's no, it's not that there's no lecturing, there will be some lecturing. We'll have a little bit more here at the beginning, I'm gonna talk about some HTML5, APIs, some things like that.

[00:00:23] So we talk a little bit more about it. But by the time we're at lunchtime and certainly this afternoon, it's gonna be an almost entirely coding. So, you're gonna have plenty to get your hands dirty with. I call this second day into node js, because again, as I said yesterday, at the beginning, my goal is to give you a firm enough confidence of JavaScript that we can dive into node js.

[00:00:46] There have been many times that I've read articles or books about Node or seen a screencast or a tutorial done about it. And they all sort of assume that you already understand JavaScript, and when you present that to someone that doesn't fully have confidence about JavaScript. It's completely Greek to them.

[00:01:04] They have no idea what you're talking about with a module and require and the scoping and all of those sorts of things. So the goal yesterday, was to present the things that were really necessary for you to have confidence in, so that when you start coding inside of node.js, those things aren't the things that you're questioning.

[00:01:21] And your brain can operate at a higher level of abstraction, because now we're dealing with how do we deal with the environment that node provides to us? How do we optimize ourselves for streaming data and all those sorts of things? That's a higher level of abstraction, and we don't want your brains worrying too much about, I don't understand the lexical scope.

[00:01:39] So hopefully, you do have that confidence, if you have questions, continue to feel free to reach out, but that's the goal of this class, that's why we did it as two day class. So, we're diving into node.js and I'm gonna focus on three major things today. We're gonna focus first on HTML5, not that we're gonna spend an awful lot of time with that, I'm gonna try to go pretty quickly through it.

[00:02:01] But I wanna expose you to some of the [COUGH] some of the API's that are provided in HTML5. Which will assist us in doing real time communication things, because that we're gonna get real familiar with node and so. But we're not gonna spend the entire day talking about every kind of like Browserify and ecosystem thing.

[00:02:22] We're going somewhere specifically with our node interaction. And once we're comfortable with node and how it works, where we're going is to wire ourselves up with some real time communication things, because I think it's a good way to show off nodes capability. One of its most one of its strongest points is its ability to do high performance communications.

[00:02:41] So, we'll first deal with HTML5, APIs that provide that. Then we're gonna talk about node, and we will pair web sockets with node and show how web sockets provide us a really great way of doing real time communication between client and server. And finally by the end of the day, we're gonna start talking about WebRTC, which is the next frontier of real time communications.

[00:03:02] WebRTC enables peer to peer communications. So rather than my laptop and your laptop having to speak through an intermediate server, we can be introduced and they can speak directly. And the fewer people that are in between us, the more real time our communications can get. So, we'll talk about what some of the capabilities are and do some future thinking about where WebRTC is gonna take the Web because I think WebRTC is the biggest inflection point that has ever happened in the history of the web platform.

[00:03:32] And I recognize that's a pretty big statement to be making. You can look back over the history of the last 15 or 20 years and see the advent of JavaScript, you can see the advent of Ajax, you can see the advent of the plug in web You can see the advent of HTML5 and the open web.

[00:03:47] There's a whole bunch of little inflection points, and I say little, sort of tongue in cheek. I think that the peer-to-peer web that we are going to see develop over the next 10 to 15 years, we'll look back and say, I can't even believe that we spent so much time in that client-server model, that old and busted model.

[00:04:04] Of the web. So, I want us to be aware of what web RTC is possible but we're just now starting to dream up what that web, what that version of the web is gonna look like. So, that's where we're headed today, hopefully that will be exciting and interesting as we go throughout the day.

[00:04:18] We're gonna start again with HTML5. I just wanna make sure everybody's aware. Hopefully this should be pretty obvious, but you definitely do need node.js. I recommend that you have at least a version 10.23 or higher. So, if you go to your command line and type in wherever your node instance can run, if you type in node, and then put a space and then do dash, dash version.

[00:04:45] It should print out something for you like 0.10.23 or higher. So 0.11 is fine. There isn't a 0.12 yet, but we're anxiously awaiting the .12 release. If you have something like node .6 or node .8, or .7 or 9, or something like that. Those are a little bit older and some of the stuff that we try to do may or may not work.

[00:05:07] So, I recommend you being on the ten branch, the newest version I think is 1026 or 1028 or something like that. 1023, they actually made a bunch of bug fixes to the HTTP method so that's why I say 1023 or higher. If you don't have that, there's plenty of time while I lecture for you to fix that, but definitely make sure that you have a good running node environment.

[00:05:29] That should also imply that you have a good running NPM environment. If you're not aware of what in NPM is, we'll teach you about NPM. But it's the package manager that allows you to install node modules really easily. So you're gonna wanna have that up and running. I say this specifically for the few of you that may have Windows machines.

[00:05:46] Because I have seen in the past, some people have, they can get node running just fine. But there have been times where certain sorts of plugins that they try to install with NPM on Windows they require a compilation, like socket IO for instance, and compilations on Windows can be a little bit dicey.

[00:06:03] I've had people have problems where they required the .netSTK that they didn't have installed or whatever. So just be aware of that. Kind of take a look at that you've got plenty of time, but make sure you do have a fully functioning NPM environment. Okay, what we're gonna talk about today will be HTML5, node.js, web sockets,and finally WebRTC.

[00:06:23] So let's jump in to HTML5.