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

Real-World WebRTC Demo

Kyle Simpson
You Don't Know JS
Check out a free preview of the full Real-Time Web with Node.js course:
The "Real-World WebRTC Demo" 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 spends the last few minutes demonstrating a real-world WebRTC application at talky.io. He also provides a few additional resources for WebRTC. - http://talky.io

Get Unlimited Access Now

Transcript from the "Real-World WebRTC Demo" Lesson

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

[00:00:04]
>> Kyle Simpson: And as a more appropriate live demo, let me show you in our final few minutes together, some products which are using web peer. I need one volunteer to raise their hand. Okay, well I'm going to type in frontendmasters here. And I'm gonna join this thing, which allows me to share my video and audio.

[00:00:28] I want you to go to talky.io/frontendmaster. I didn't put the s on the end, so just frontendmaster. Yeah.
>> Kyle Simpson: Talky.io is a service that's built by a company called &yet. They're a leader in peer to peer WebRTC technology, and this is a completely free web conferencing service. Totally encrypted.

[00:00:54] Not only does it allow you to share your video and audio, but they just recently added in screen cast sharing. So if you're in Chrome, you can share your screen against somebody else. Is it popping up for you?
>> Speaker 2: I've used this tool before actually.
>> [SOUND]
>> Kyle Simpson: There we go.

[00:01:11] I got somebody else to add in. There we go. I'm better turn down the audio. Now you can see that the two of us, you can connect with your grandma on the other side of the world, completely for free. Totally through web technology and there's no middleman, because now that we've been in establishing peer to peer connection now we're talking.

[00:01:29] So now we've got three of us in the same thing. So it's a lot like Google Hangouts, except it's completely free and there's no evil corporation in the middle. All right. So just a couple of other quick things to point out to you. Things that are being built on peer to peer data channels.

[00:01:50] There's a service that was built. By a group of researchers at MIT called PeerServer. It's literally exactly what it sounds like. You spin up a web server inside of your browser and you serve up web pages to other people that are nearby. So imagine you and your company go for a week offsite team meeting and you wanna spin up a Wiki Server for everybody to collaborate during the week.

[00:02:13] Well, one of you spins it up on your laptop, and the rest of the people on the team just connect directly to that system and you don't need to stick all of your work files out on some outer server. Another thing, this actually is really cool, and might blow your mind a little bit.

[00:02:29] This is a service that started up as kind of an interesting thing but PeerCDN, what they did Is they built a service that allows you to put a script tag in your page, and it hijacks your page and any of the places in the page where you're loading resources from a CDN location, like from the Google CDN or whatever.

[00:02:52] What it does, is instead of loading them from the CDN, it attempts in the background to establish a peer to peer connection with somebody else who's also on the site at that moment. And if they are on the site and they've already downloaded the files, it sends you those files over the peer to peer connection rather than through the bandwidth connection.

[00:03:12] So as a provider of a site. You have the ability to serve up less bandwidth, which means it's gonna save you costs because you're not paying for CDN bandwidth. And also they proved, that it was in general, much quicker for users to get files from their peers than from some CDN.

[00:03:28] And it did it completely in the background without you even knowing that it was happening and if it failed to download it. It fell back to the normal loading. And so that sounds like the sort of hack that nobody could actually pull off but they did it so well that Yahoo acquired them few a few months ago, so that's pretty cool.

[00:03:45] It's a kinda a big success story for these peer to peer technologies. There is a sharefest.me, [COUGH] this is exactly what it sounds like, a completely secured anonymous instant file sharing peer to peer, without anybody in the middle. You wanna drop an MP3 file to your grandma, tell her to go to this site exactly like you do with talk, tell her to go to this site, you drop a file in there, bam, it shows up on her computer and vice versa.

[00:04:20] Using the peer to peer data connection. And there's lots and lots of others. I could spend lots and lots of extra time talking about the capabilities. We're not even beginning to scratch the surface of what peer to peer data connections are going to give us in terms of a different way of doing the web than we've ever done before.

[00:04:39] So I'm really excited about that. I'm excited about the performance benefits, I'm excited about the security and the privacy benefits that we're gonna get from the peer to peer web. But it's a web that we have to build. It's a web that everybody in this room has to help us build.

[00:04:54] So if we sit around and we say, just I'm worried about getting rounded corners into my app, and sit five years in the past, somebody else is gonna be making the decision. It's probably going to be some evil corporation that none of us like, that makes the decisions for the future of this technology.

[00:05:12] So, I would implore you, if you don't get anything else out of today, start experimenting with this technology. Start experimenting with peer-to-peer technology, use the frameworks and things that are out there, and pushing back on this stuff, because we are in a position to form the next major inflection point of the web.

[00:05:31] And it's gonna open up a whole new world of possibilities that we weren't capable of doing before. So, hopefully, you come away from today with a lot more confidence about where to start with node, about where to start with hacking up command line tools or building little web things.

[00:05:51] The very first node program that I ever built several years back, I was working at that game company. And we needed a tool to essentially, it wasn't really load testing, but we needed a tool to test whether or not the bingo game was capable of handling 5,000 concurrent players in the same bingo game.

[00:06:12] Was the game logic actually correct to handle all those players and calling things? And so I actually wrote a node.js bot that would spin up 5,000 instances of itself. It knew the rules of the game, in terms of being served up random numbers, and looking for bingo, and calling out bingo and stuff.

[00:06:30] And these bots would play against our game server in real time to try to test whether or not the server was written correctly. So the possibilities for what you can do with node are endless. They're really as limited as you are willing to start experimenting and I hope you come away from today with the confidence that it's time to get experimenting, it's time to start pushing on that stuff.

[00:06:52] I hope I've given you lots of different ways to think about it, different kinds of conversations that you can have with your bosses. It's been a true honor to give this workshop over the last couple of days. Hope you've learned a lot of great things, I hope you'll give us feedback and I'll be giving this workshop many more times, help me get feedback to help me make it better.

[00:07:10] And again I wanna remind you. I'll go back to my slide as my finishing thing. I wanna remind you that as an open ended invitation to all of my attendees of any workshop from here on out, if you have any thoughts or questions six months from now you're going back over the exercises and you have a question, feel free to reach out.

[00:07:27] There are lots of ways to get in contact with me online. I appreciate your time very much. It's been an honor being here. You guys have a good evening.