Sockets have become the standard for server-to-server communication in the last few years. They are everywhere, and they are fast. As a result, there has been a surge of interest in Socket.IO, the server-side implementation of the HTML5 WebSockets API. If you have used Socket.IO with any success, then congratulations! You are ready to take your next step into the world of advanced Socket.IO development. In this tutorial, you will build a Socket.IO-based messaging application from start to finish. The application will allow users to send and receive messages via Socket.IO, and you will be able to follow along and build it from start to finish yourself.
What You Will Learn
Socket.IO is an open-source JavaScript library that allows a server to act as a (publish/subscribe) hub, or "socket." It's designed to be used with WebSockets, but it can also work with normal sockets. The server acts as a hub where users can send messages to a group of subscribers. You will use Socket.IO to build an app where users can send messages to each other.
How to Set Up Your Environment
Node.js - Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. It's used to build server-side apps that can take advantage of the JavaScript language's features.
NPM - npm is the package manager for Node.js. It allows you to download and manage libraries for Node.js apps.
Getting Started: Install Socket.IO
Make sure you have Node.js and NPM installed on your computer. Once you have those two dependencies installed, you can install Socket.IO.
Node.js users should run this command in their command line or terminal:
Install Socket.IO on Node.js
npm install socket.io