From the course: Node.js: Real-Time Web with Socket.IO

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Code and test our first interactions

Code and test our first interactions

- [Instructor] Now we've got the HTML ready for our messages, a running socket.io server. Let's get some interactions in place for our chatter. So the first thing I want you to do is go inside of the index.html. So let's go ahead and do that, and we'll change the code here because now we're going to send an event, which will change the way this area looks like. It's going to create LIs every time someone enters a message. So let's go ahead and change that. Okay, so what we are going to do first is change this here because, when you run this function, it assumes that you're running on a specific server. So we'll be fine with just that. Next what we'll use is leverage some of the jQuery code. So we already have it because of Bootstrap, so we don't need to load it on top of what we already have. So let's go ahead and do this. So we'll use the form. So whenever there's something that happens on the form, so whenever there's a submit, what we'll do is the following. So we'll create a…

Contents