From the course: Node.js: Web Servers, Tests, and Deployment

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Creating a WebSocket

Creating a WebSocket

- [Instructor] WebSockets allow for a true two-way connection between the client and the server. Clients connect to a socket server, and the connection remains open until a client disconnects. And while that connection is open, data can be passed to and from the server. Again, it looks like our front-end team has delivered the files to us inside of this client application. And all of these files should run in the browser. So let's make sure that we're in the start file, and we're going to run that same command. But this time we want to also supply a flag where we're going to run this on port 5000. So we can go ahead and pass that along. It's going to run this on port 5000, and if we go back to our browser, localhost 5000, it should bring up our chat application. So if we take a look at our browser console, it's saying WebSocket connection to ws localhost 3000 has failed. So it's trying to connect to this WebSocket, but…

Contents