Build A Websocket Server With Node.Js – No Libraries – 2024


Build A Websocket Server With Node.Js – No Libraries – 2024
Build A Websocket Server With Node.Js – No Libraries – 2024
Published 9/2024
MP4 | Video: h264, 1920×1080 | Audio: AAC, 44.1 KHz

Advanced WebSocket server course for everyone! Build a WebSocket server from scratch using JavaScript. No libraries.

What you’ll learn

Build a custom server that can receive large, fragments of WebSocket data

Master the concepts of fragmentation, streaming and chunks

Learn Bitwise parsing (shift operators, AND, OR and XOR)

Understand and work with Buffers

Gain a deep understanding of pure WebSockets (no libraries)

Binary processing of WebSocket data

Use the debugger to test and fix server code

Understand SHA hashing and the crypto module

Requirements

Basic knowledge of WebSockets required. Check out my WebSockets Protocol – Very Informative course

Basic knowledge of JavaScript and HTML will be helpful

Desire to understand the INNER-WORKINGS of the pure WebSocket protocol (no libraries)

Desire to become a WebSocket ninja

A computer is required as you need to code alongside me to learn effectively

Description

Overview

Section 1: Introduction

Lecture 1 Introduction

Lecture 2 To build a WebSocket server, we need to be RFC compliant

Lecture 3 Course Structure

Lecture 4 Take matters into your own hands.

Section 2: Creating a NodeJS server

Lecture 5 WebSocket Server Goal: Create a HTTP web-server

Lecture 7 Overview of HTML and CSS

Lecture 8 Setting up our HTTP server

Lecture 9 Creating custom modules and finishing off the HTTP server

Lecture 10 Implementing basic error handling

Lecture 11 Using "Run and Debug" to examine the forEach loop

Lecture 12 Testing our error handling code

Lecture 13 Project Files: HTTP server

Section 3: Establishing a WebSocket Connection

Lecture 14 WebSocket Server Goal: Establish a WebSocket Connection

Lecture 15 Using the ‘upgrade’ event listener to receive 3 important object

Lecture 16 Examining the request object in the terminal

Lecture 17 Reading the client’s opening handshake request headers

Lecture 18 Sending a "400 Bad Request" response if the client handshake headers fail

Lecture 19 Generate the server response headers object

Lecture 20 Extracting the Sec-WebSocket-Key and using the crypto module

Lecture 21 Timeout! What is SHA-hashing and the crypto module?

Lecture 22 Generate the Sec-WebSocket-Accept value and send back headers to the client

Lecture 23 Testing our code and opening up a valid WebSocket connection

Lecture 24 Summary

Lecture 25 Project Files: Establishing a WebSocket connection

Section 4: Receiving WebSocket Data

Lecture 26 WebSocket Server Goal: Extract Payload Data

Lecture 27 Setting up our file for the next goal

Lecture 28 The socket object inherits from the stream.Duplex class

Lecture 29 The socket object is a duplex stream, allowing us to listen for chunks

Lecture 30 Defining our data event handler

Lecture 31 Quick cut – adding the ‘end’ event listener to our socket object

Lecture 32 Define the processBuffer() function

Lecture 33 The WebSocket binary frame structure

Lecture 34 Coding the task management looping function

Lecture 35 Extract the first 2 bytes of data from the WebSocket data frame

Lecture 36 What are Buffers?

Lecture 37 Buffers are mandatory

Lecture 38 Why is the letter "a" sent as 7 bytes?

Lecture 39 Using the Debugger tool to analyze code

Lecture 40 Extracting the FIN bit

Lecture 41 Bitwise operators

Lecture 42 Extracting the MASK, OPCODE and initial LENGTH information

Lecture 43 Next steps

Lecture 44 Setting up code to extract the payload length details

Lecture 45 The 3 categories of payload lengths

Lecture 46 Payload length recap

Lecture 47 Calculating the payload length

Lecture 48 Summary

Lecture 49 Breakdown of the getLength() method

Lecture 50 The readUInt16BE() method

Lecture 51 Payload length checks

Lecture 52 Next Steps

Lecture 53 Extract the Masking Key

Lecture 54 Next steps

Lecture 55 Define the getPayload() method

Lecture 56 Checking for whether we need additional chunks of data

Lecture 57 Extract one full frame of data (masked)

Lecture 58 Why did I not use the _consumeHeader() method?

Lecture 59 Unmasking the frame payload

Lecture 60 What is the modulus operand

Lecture 61 Create a persistent fragments array and check for more frames (FIN bit check)

Lecture 62 Why have a fragments array?

Lecture 63 SMALL payloads – Using the debugger to analyze logic

Lecture 64 Fixing the error in our consumePayload() method

Lecture 65 Adding a prepopulate button to the HTML

Lecture 66 MEDIUM Payloads – Using the debugger to analyze logic

Lecture 67 Why did I use readUInt16BE()

Lecture 69 What is BigInt?

Lecture 70 Chunks, Frames and Messages

Lecture 73 Improvements comments and adding opcode checks

Lecture 75 Improving our _getInfo() method

Lecture 76 Project Files: Extract Payload Data

Section 5: Sending WebSocket Data

Lecture 77 WebSocket Server Goal: Send A WebSocket Message

Lecture 78 Getting project files ready to send data to the client

Lecture 79 Creating a blueprint of the sending frame

Lecture 82 Create the binary frame buffer blueprint

Lecture 83 Creating the first byte of the frame

Lecture 84 Why did I choose to set opcode to BINARY

Lecture 85 Bitwise shift operators

Lecture 86 Populate the frame header with data

Lecture 87 Sending the frame to the client

Lecture 88 Testing whether the client received the frame

Lecture 89 Blobs – did you know?

Lecture 90 Sending data to the client via the write() method

Lecture 91 Creating a reset() function

Lecture 92 Using debugger tool to examine code

Lecture 93 How does the WebSocket API handle fragmentation

Lecture 94 Displaying the WebSocket message on the client-side

Lecture 95 Why did I use the FileReader interface?

Lecture 96 Project Files: Sending Data

Section 6: Responding to a closure frame

Lecture 97 WebSocket Server Goal: Send & Receive A Closure Frame

Lecture 98 Setting up project code and defining our mini-goal

Lecture 99 Closing handshake

Lecture 100 Extracting the body (closure code and reason) of the close frame

Lecture 101 Both peers have to send a close frame

Lecture 102 Close Frame Structure

Lecture 103 Construct the payload buffer for the close frame

Lecture 104 Closure codes

Lecture 105 Completing and sending the final close frame back to the client

Lecture 106 Testing our code

Lecture 107 Using Wireshark to master the TCP closure process

Lecture 108 Checking for "ping" and "pong" data type, and payloads larger than max size

Lecture 109 Ping and Pong

Lecture 110 Ping & Poing vs TCP Keepalive

Lecture 111 Extracting the server response from the CloseEvent object

Lecture 112 Sending a closure frame if the masking bit is not set correctly by the client

Lecture 113 Check whether client has sent a closure code

Lecture 114 Displaying default closure message (for normal closure event)

Lecture 115 Fixing comments and removing server response text when new connection is made

Lecture 116 Server side validation for text

Lecture 117 Fixing the refresh issue killing the server

Lecture 118 Project Files: Dealing with Closure Frames

Importantissimo!

Per NON SBAGLIARE link e finire su qualche possibile clone, approfittare di offerte esclusive personalizzate per il nostro sito, e se gradisce questo articolo ed il nostro lavoro, la preghiamo di supportarci rinnovando o sottoscrivendo un Account Premium su FILESTORE cliccando sul link qui sotto:

FileStore

Share This Post!

Torna in cima