Web Application Development using Redis, Express, and Socket
3.8 (21 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
330 students enrolled
Wishlisted Wishlist

Please confirm that you want to add Web Application Development using Redis, Express, and Socket to your Wishlist.

Add to Wishlist

Web Application Development using Redis, Express, and Socket

Get started with building robust, dynamic, real-time applications using the powerful frameworks of Node.js
3.8 (21 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
330 students enrolled
Created by Packt Publishing
Last updated 2/2017
Curiosity Sale
Current price: $10 Original price: $200 Discount: 95% off
30-Day Money-Back Guarantee
  • 6 hours on-demand video
  • 1 Supplemental Resource
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
What Will I Learn?
  • Discover the commands, data types, and the storage structure of Redis
  • Learn how to build sites by integrating Redis and Node.js
  • Master the installation and application of Socket.IO
  • Interact with different browsers using Node.js and Socket.IO
  • Learn how to implement out-of-process messaging using Socket.IO with Express
  • Create rich and interactive real-time dashboards using Socket.IO to pipe in data as it becomes available
  • Design chat and multiple-person interfaces that leverage Socket.IO for communication
  • Secure your data by implementing various authentication techniques, locking down the HTTP referrer and using secure WebSockets
  • Load balance across multiple server-side nodes and keep your WebSockets in sync using Redis, RabbitMQ, or Memcached
View Curriculum
  • Basic knowledge of any scripting language; JavaScript would be beneficial
  • A computer with a good Internet connection

Looking to build scalable and real-time applications in one of the simplest ways possible? You’ve come just to the right place!

This is one of Packt’s Video Learning Paths which is a series of individual video products put together in a logical and stepwise manner such that each video builds on the skills learned in the video before it.

In this Learning Path, we look at implementing real-time applications on websites using SocketIO, Express, and Redis.

SocketIO has been used in creating many real-time chat and blog applications because of its powerful real-time engine. Yes, Socket. IO features one of the fastest and most reliable real-time engines. This makes it almost perfect for real-time analytics, instant messaging, and two-way communication between the browser and web application. Redis opens doors by making data quick and easy to fetch. Lastly, Express helps by making full-featured web applications easy. A powerful combination of these three will give you awe-inspiring application experiences and you’ll be able to create fast, scalable, and dynamic real-time apps in no time!

Essentially, this Learning Path is a practical guide on integrating Redis and NodeJS and making a site realtime using Node.js and SocketIO.

By the end of the Learning Path, you will be a competent SocketIO developer and will be able to create fast, scalable, and dynamic real-time apps.

About the authors:

This Learning Path, contains the best works of Joshua Johanan and Tyson Cadenhead who are experienced at creating applications.

Joshua Johanan is currently a web developer with over 7 years of experience writing sites and applications in many different languages. These languages include PHP, Python, JavaScript, and C#. Using many languages also means using many frameworks, including Zend Framework, Django, and .Net MVC. He is the author of two books, Building Scalable Apps with Redis and NodeJS and Web Developer’s Reference Guide

Tyson Cadenhead works as a senior JavaScript engineer at Aloompa in Nashville, Tennessee. He has dedicated his professional career to building large-scale applications in JavaScript and Node. Tyson addresses audiences at various conferences and programming meetups on how to build real-time web applications with SocketIO or MeteorJS. 

Who is the target audience?
  • If you are willing to build web applications using real-time communication, then this Learning Path is ideal for you. Basic knowledge on JavaScript would be advantageous.
Students Who Viewed This Course Also Viewed
Curriculum For This Course
66 Lectures
Build Complex Express Sites with Redis and Socket.io
27 Lectures 03:27:11

This video gives overview of the entire course.

Preview 03:58

What is Redis/Redis CLI?

Redis CLI

Redis data types.

Redis Data Types

What is the Redis commands?

Redis Commands

Redis does not have traditional indexes.

Redis Storage Structures

Redis does simple messaging. We cover what that means and how to do it.

Preview 05:03

How to receive messages from Redis PUBSUB.


Using Redis PUBSUB.

Using Redis Messaging

How do we use what we know about Redis with Node.js?

Simple Redis Integration

Using PUBSUB in Node.js.


Many times, Redis has data that is stored across multiple keys. This makes getting the data difficult. 

Store Complex Data

How do we use sorted sets?

Store Complex Data with Sorted Sets

Using geospatial indexes with Redis.

Geospatial Indexes

This is our first introduction to Socket.io.

Installing Socket.io

Building a simple Socket.io application.

Simple Socket.io application

How do we communicate with more than one browser?

Interacting with another browser

We can send to every connection, but sometimes we want every connection but ours.

Broadcasting a message

One more event to tie everything together.

Using the disconnect event

What are rooms and why use them?

What Are Rooms?

What are namespaces and why use them? 

What are Namespaces

How to use rooms in an actual application.

Create a Simple Rooms Application

How to use namespaces in an application.

Create a Simple Namespace Application

We are now going to start integrating Socket.io and Express together.

Share State Between Socket.io and Express

Integrated Socket.io and Express do not share requests. How do we get them to work together?

One Problem with Socket.io and Express

How to use Socket.io events and Express routes together.

Using routes with Socket.io and Express

Many sites today have multiple servers that run them.

Using Redis for Multi-Server Socket.io

Sending messages from other processes and even other languages.

Out of Process Messaging
Socket.IO Solutions
39 Lectures 02:22:07

This video gives an overview of the entire course.

Preview 03:36

In order to get Socket.IO running, we need to have at least one client and one server set up to talk to each other.

Creating a Node HTTP Server with Socket.IO

Express is probably the most widely used Node application framework and we can use Socket.IO based on an Express server.

Creating an Express Server with Socket.IO

The native WebSocket implementation in browsers is much less robust than what Socket.IO offers. We’ll set up Socket.IO as a Web Socket.

Using Socket.IO as a Cross-browser

Socket.IO gives us the ability to toggle certain parts of our logging on and off as needed. Let’s dive into debugging our code.

Debugging Our Code

We will create an application that emits a static object. The client side doesn't concern itself with the frequency of state changes, so the difference between emitting data once and emitting data frequently is inconsequential. If we can re-render the state of a dashboard once, we can re-render it many times.

Loading Static Data from the Server

It is sometimes useful to have the date and time from the server side instead of the client side.

Creating a Server-Side Clock

As we are now able to send static data to our client with Socket.IO, we have all the tools we need to send dynamic data as well.

Loading Data from MongoDB

Socket.IO excels at creating rich real-time analytic dashboards.

Let’s Go Real-Time!

The goal of this video is to create a simple chat room using Socket.IO.

Creating a Simple Chat Room

We are going to manage the socket life cycle in this video.

Managing the Socket Life Cycle

Sometimes, you need to send a private message to just one other socket and not every socket that may be listening in. As the server side is in charge of managing all the connected sockets, we can specify the sockets that our events are emitted to granularly. In this video, we will use this ability to create a simple app.

Emitting a Private Message to Another Socket

When a socket sends a message, we don't necessarily want it to receive the message that it sent. We may want to display a different message to the sender than to the receivers. This can be accomplished using the socket broadcast emit syntax, which we will look at in this video.

Sending Messages to All Sockets Except the Sender

We can observe the real power of Socket.IO by using it in a multiplayer game. In this video, we will just do that in a game of tic-tac-toe.

Building a Multiplayer Tic-Tac-Toe Game

Many applications have multiple customers, which should never be mixed. In the same way, our Socket.IO sockets can be namespaced to minimize concerns about intermingling data and messaging.

Creating Chat Channels with Namespaces

In addition to namespaces, we can use Socket.IO rooms to ensure that our messages are being delivered to the correct sockets.

Joining Rooms

If you're building a real-time application, it’s important that a socket can not only join a room but also leave any room that it is a member of.

Leaving Rooms

Socket.IO provides a dynamic list of rooms that each socket is a member of. We can retrieve this list and make sure it updates dynamically when the socket leaves a room.

Listing Rooms the Socket Is In

Although Socket.IO doesn't have any inbuilt way to consider a room as private or public, we can add some logic around joining a room so that only sockets that validate against a password check are allowed to be members of the room.

Making Private Rooms

In Socket.IO, every socket that makes a connection is assigned a default room to emit messages. This default room could be used for a wide variety of purposes.

Setting Up a Default Room

Most applications need a way to authenticate users. In this video, we will create a simple form to create and authenticate users.

Implementing Basic Authentication

Now that we have been able to perform basic authentication with Socket.IO, let's take a look at a token-based approach that handles authentication more securely, such as JSON Web Tokens, or JWT.

Doing Token-Based Authentication

When we write data to a database, it is important to perform validation on the server side to ensure that the data is in the type and format that we expect it to be in. In this video, we will demonstrate how we can emit data to the server and emit messages back if there is success or an error.

Handling Server-Side Validation

There are some instances where you may not want your Socket.IO events to be available to every other domain. Not to worry! We can easily whitelist only the HTTP referrers that we want so that some domains will be allowed to connect and other domains won't.

Locking Down the HTTP Referrer

If your application uses the HTTPS protocol, you will also need to use the wss protocol for your Web Sockets. Let’s see it in action.

Using Secure Web-Sockets

A single-node server can typically handle several thousand simultaneous connections.  However, as the audience of an application grows, it is important to make sure that the application is scalable. In this video, we’ll see Nginx in action performing load balancing.

Performing Load Balancing with the Nginx Server

Node.js comes with a cluster package that can be used to run Node on multiple threads, as opposed to the single thread that it runs on normally. Unfortunately, there is some boilerplate needed to determine the number of CPUs available to run Node processes and fork the original node. For this, we can use a module called sticky session. Let’s see it in action in this video.

Using Node.JS Cluster

Now that we are able to run multiple nodes simultaneously with Socket.IO and not lose our socket connection between events, we will also need a way to ensure that when an event is emitted on one node, it is also emitted across all of our other nodes.

Using Redis to Pass Events Between Nodes

In this video, we will use Memcache to propagate events across multiple server nodes.

Using Memcache to Manage Multiple Nodes

In this video, we will use RabbitMQ, which allows you to use multiple servers and broadcast messages across them.

Using RabbitMQ to Message Events across Nodes

We can use Socket.IO to send images from a browser to a server. We can then display them in another browser without storing them on a server, a filesystem, or a database of any kind. In instances where we don't need the data to be stored, this can be really useful.

Broadcasting an Image to Other Sockets

Using Socket.IO, we can send files to our server over WebSockets instead of an http POST request.

Uploading an Image to the Filesystem

If you are deploying the app from your repo, uploading images to your server-side file isn’t advised. A much better approach is to put the media in a separate location, such as Amazon S3.

Uploading an Image to Amazon S3

Streaming images with Socket.IO is great. However, we can also use WebSockets in combination with WebRTC to stream audio from one user's microphone to another.

Streaming Audio

While streaming audio is great, live video is even more gratifying.

Streaming Live Video

Apache Cordova wraps your application in a web view and uses JavaScript to expose certain native events to the application. Let’s see how we do it in this video.

Throwing an Alert When the Socket Connects

We can use our central server-side location as an API for multiple applications.

Responding to Tap Events from the Device

When you have a huge amount of data, it is advisable to create a paged format so that the data won’t be loaded all at once.

Performing Server-Side Pagination

Use the power of Socket.IO to trigger “Hot Deploys” and refresh the code in the Cordova web view without needing the resubmit their app to the app store.

Triggering Hot Deploys
About the Instructor
Packt Publishing
3.9 Average rating
7,336 Reviews
52,505 Students
616 Courses
Tech Knowledge in Motion

Packt has been committed to developer learning since 2004. A lot has changed in software since then - but Packt has remained responsive to these changes, continuing to look forward at the trends and tools defining the way we work and live. And how to put them to work.

With an extensive library of content - more than 4000 books and video courses -Packt's mission is to help developers stay relevant in a rapidly changing world. From new web frameworks and programming languages, to cutting edge data analytics, and DevOps, Packt takes software professionals in every field to what's important to them now.

From skills that will help you to develop and future proof your career to immediate solutions to every day tech challenges, Packt is a go-to resource to make you a better, smarter developer.

Packt Udemy courses continue this tradition, bringing you comprehensive yet concise video courses straight from the experts.