Workshop
Workshop
Introduction
HTML, CSS
Javascript & DOM
NodeJS
Socket.io
Encryption and decryption
Project demonstration
What happens when you open google.com in your device
Your browser fetches the IP address for Google's servers
The browser sends an HTTP request to the server asking for the webpage
located at "google.com". This request includes information such as the type
of request being made, the browser type and version, and any cookies or
other data associated with the website.
The server recieves the request and returns the corresponding data.
This data could be HTML, CSS, JS, or JSON files.
Your browser can now render this data.
Now when you hit on search, you send a request from your device to
Google's back-end servers
These servers now process your query and send the appropriate
results back to your browser, and your browser renders it.
This is a example of a HTTP connection. You are sending a request to
another device (Google's server), the device is processing your
request and giving you an appropriate result which is rendered by
your browser.
In this case the connection made to the server is closed as soon as the
response is recieved. So no further communication can take place
between the server and the client.
WEB SOCKET
A WebSocket is a protocol that allows for real-time, bi-directional
communication between a client and a server over a single, long-lived
connection.
In the previous case the connection between the server and the client is closed
after the response is sent. This would mean no further communication can
happen between the two devices.
But in a web-socket connection, the TCP connection is kept alive and data is
continuously shared using it.
Most modern websites use WebSockets in one way or another, but the most
prominent uses are mentioned below:
Chat apps - WhatsApp, Instagram, Twitter
Live streaming apps - Youtube, Twitch
Browser based games - slither.io, Lichess
Hyper Text Markup Language
(HTML)
HTML Introduction
Html tags and attributes
Attributes:
Attributes provide additional information about elements
Attributes are always specified in the start tag and it comes in the form:
Example:
<a href="www.google.com">Take me to Google</a>
The <a> tag defines a hyperlink. The href attribute specifies the URL of the
page the link goes to.
Some Other Elements in HTML
Classes and IDs
CLASS:
The HTML class attribute is used to specify a class for an HTML element.
Multiple HTML elements can share the same class.
Classes and IDs
IDs:
The id attribute specifies a unique id for an HTML element. The value of the
id attribute must be unique within the HTML document.
First HTML website created-1993
Cascading Style Sheet (CSS)
CSS is the language we use to style a Web page
There are four ways for iterating through a loop which are-
for
for in
for of
while
Functions
API stands for Application Programming Interface. There are four types of
API which are-
Web API
Browser API
Server API
Third party API
Asynchronous Javascript
Promises-
"Producing code" is code that can take some time
"Consuming code" is code that must wait for the result
A Promise is an Object that links Producing code and Consuming code
The keyword async before a function makes the function return a
promise
The await keyword can only be used inside an async function. The
await keyword makes the function pause the execution and wait for a
resolved promise before it continues
Encryption
Encryption is the process of converting plaintext into ciphertext, which can only be read if
decrypted.
Encryption Process:
Uses a pair of keys, a public key for encryption and a private key for decryption.
Examples include RSA (Rivest-Shamir-Adleman) and ECC (Elliptic Curve
Cryptography).
Provides a more secure method for key distribution, as the private key is never
shared.
Slower than symmetric encryption but more secure for exchanging keys and
securing communication.
Using asymmetric encryption for E2E
Key Generation
When a new user joins a room, they are given a pair of public and private keys using the
jsencrypt library. These keys are used for encryption and decryption.
client address
server url
socket.on & socket.emit
Client Side
Server Side
Sending messages to the server using socket.emit
Webpage Output
Sending messages to the client from the server
Server side
sends the event, receive-message
to all the sockets including the one
which made the request
Client Side
DIsplaying the message from
the server
Sending messages to the client from the server
Server Side
Other services
Thank you!