Real-Time Web with Node.js Into Node.js
This course has been updated! We now recommend you take the Complete Intro to Real-Time course.
Transcript from the "Into Node.js" Lesson
>> 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: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: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.