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 client with Socket.IO

Creating a WebSocket client with Socket.IO - Node.js Tutorial

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

Creating a WebSocket client with Socket.IO

- [Instructor] In the last lesson, we created a web socket and connected to it using the native web socket object in the browser. Native web sockets are really cool but there are some edge cases that a native web socket cannot handle on its own. If we want our apps to work in a hundred percent of the browsers, we need to have a solution that can still work if web sockets aren't supported. Socket.IO is a web socket framework that falls back to different data polling techniques in environments that don't support web sockets. So what this means is that you can build a real time app that's supported in every browser. So let's start to build our server using Socket.IO. We're going to install socket.io into our project. And then I'm just going to replace everything that's part of this file. I'm going to delete it all and replace it with a server. So we're going to go ahead and pull create server from the HTTP module.…

Contents