Socket IO Solutions
2.8 (17 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.
123 students enrolled
Wishlisted Wishlist

Please confirm that you want to add Socket IO Solutions to your Wishlist.

Add to Wishlist

Socket IO Solutions

Create real-time JavaScript applications using the robust Socket.IO framework
2.8 (17 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.
123 students enrolled
Created by Packt Publishing
Last updated 3/2017
Current price: $10 Original price: $85 Discount: 88% off
5 hours left at this price!
30-Day Money-Back Guarantee
  • 2.5 hours on-demand video
  • 1 Supplemental Resource
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
What Will I Learn?
  • Build 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
  • Segment conversations to rooms and namespaces so that every socket doesn’t have to receive every message
  • 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
  • Stream binary data such as audio and video in real-time over a Socket.IO connection
  • Create real-time experiences outside of the browser by integrating Socket.IO with hybrid mobile applications
View Curriculum
  • This course is full of practical, immediately usable task-based videos that show you how to create the elements of a Socket.IO application.

Socket.IO is a JavaScript library that provides you with the ability to implement real-time analytics, binary streaming, instant messaging, and document collaboration. It has two parts: a client-side library that runs in the browser, and a server-side library for node.js. Socket.IO is event-driven and primarily uses the WebSocket protocol that allows us to emit data bi-directionally from the server and the client. Socket.IO

This video course is a complete resource, covering topics from WebSocket security to scaling the server-side of a Socket.IO application and everything in between.

This video course will provide real-world examples of how secure bi-directional, full-duplex connections that can be created using Socket.IO for different environments. It will also explain how the connection vulnerabilities can be resolved for large numbers of users and huge amounts of data/messages.

By the end of the course, you will be a competent Socket.IO developer. With the help of the examples and real-world solutions, you will learn to create fast, scalable, and dynamic real-time apps by creating efficient messaging systems between the server side and the client side using Socket.IO.

About The Author

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 Socket.IO or Meteor.js. 

Tyson lives in the greater Nashville area with his wife and two sons, where he enjoys gardening, raising chickens, reading philosophy and economics books, and playing guitar.

Who is the target audience?
  • If you have some knowledge of JavaScript and Node.js and want to create awe-inspiring application experiences using real time communication, then this book is for you. Developers with knowledge of other scripting languages should also be able to easily follow along.
Compare to Other Socket.IO Courses
Curriculum For This Course
38 Lectures
Wiring It Up
4 Lectures 16:07

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.

Preview 03:36

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 WebSocket

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
Creating Real-Time Dashboards
4 Lectures 15:15

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.

Preview 04:35

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. It also has some really great built-in functionality to re-establish a server-side connection once it has been dropped.

Let's Go Real-Time!
Having Two-Way Conversations
5 Lectures 15:17

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

Preview 04:17

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
Building a Room with a View
6 Lectures 17:40

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. Let's look at how to create namespaces.

Preview 03:20

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
Securing Your Data
5 Lectures 19:24

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

Preview 04:37

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
Performing a Load Balancing Act
5 Lectures 21:47

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.

Preview 04:04

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. For a distributed system, we will need to use an adapter that lives outside of our server nodes. Redis is a perfect solution for this problem; let's see how.

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
Streaming Binary Data
5 Lectures 16:09

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.

Preview 03:51

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

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
Integrating with Mobile Applications
4 Lectures 14:27

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.

Preview 05:03

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
8,229 Reviews
58,947 Students
687 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.