You are on page 1of 5

The WebSocket API is an advanced technology that makes it

possible to open a two-way interactive communication session


between the user's browser and a server. With this API, you can send
messages to a server and receive event-driven responses without
having to poll the server for a reply.
WebSocket is a communications protocol for a persistent, bi-
directional, full duplex TCP connection from a user's web browser to
a server. A WebSocket connection is initiated by sending a WebSocket
handshake request from a browser's HTTP connection to a server to
upgrade the connection.

Socket.io
Realtime, bi-directional and event-based communication between the browser
and server.
Server – NodeJS
Brower – JS client library

Bi-directional – Two or more parties take part in the conversation (Phone


Conversation)
Endpoint communication

Socket
TCP
• Transmission Control Protocol – Chat Application
• Reliable communication
• Delivery Guarantee
• Bi-directional.
UDP
• Unreliable delivery – Broadcast, Multicast
• No guarantee
• Can send/receive.

Client Server Architecture


Client request data from the server
Server process the request
After that server gives the output/ response to the client
Map For Each
returns a new array does not return a new array
used to transform the elements of an array used to loop through the elements of an
array.

can be used with other array methods, such cannot be used with other array methods.
as the filter() method

Single Responsibility Principle


a class should do one thing and therefore it should have only
a single reason to change.

if a class is a data container, like a Book class or a Student


class, and it has some fields regarding that entity, it should
change only when we change the data model.
Open-Closed Principle
classes should be open for extension and closed to
modification.

We should be able to add new functionality without touching


the existing code for the class. This is because whenever we
modify the existing code, we are taking the risk of creating
potential bugs. So we should avoid touching the tested and
reliable (mostly) production code if possible.

Liskov Substitution Principle


subclasses should be substitutable for their base classes.

This means that, given that class B is a subclass of class A, we


should be able to pass an object of class B to any method that
expects an object of class A and the method should not give
any weird output in that case.

Interface Segregation Principle


separating the interfaces.

many client-specific interfaces are better than one general-


purpose interface. Clients should not be forced to implement
a function they do no need.

Dependency Inversion Principle


our classes should depend upon interfaces or abstract classes
instead of concrete classes and functions.
A peer-to-peer (P2P) architecture consists of a
decentralized network of peers - nodes that are both clients
and servers. P2P networks distribute the workload between
peers, and all peers contribute and consume resources
within the network without the need for a centralized server.

S.NO Client-Server Network Peer-to-Peer Network

In Client-Server Network, Clients


and server are differentiated, In Peer-to-Peer Network, Clients
1.
Specific server and clients are and server are not differentiated.
present.

Client-Server Network focuses on While Peer-to-Peer Network


2.
information sharing. focuses on connectivity.

In Client-Server Network,
While in Peer-to-Peer Network,
3. Centralized server is used to store
Each peer has its own data.
the data.

While in Peer-to-Peer Network,


In Client-Server Network, Server
Each and every node can do both
4. respond the services which is
request and respond for the
request by Client.
services.

While Peer-to-Peer Network are


Client-Server Network are costlier
5. less costlier than Client-Server
than Peer-to-Peer Network.
Network.
S.NO Client-Server Network Peer-to-Peer Network

While Peer-to-Peer Network are


Client-Server Network are more
6. less stable if number of peer is
stable than Peer-to-Peer Network.
increase.

A communications protocol is a set of formal rules


describing how to transmit or exchange data, especially
across a network.

• File Transfer Protocol (FTP)


• TCP/IP
• User Datagram Protocol (UDP)
• Hypertext Transfer Protocol (HTTP)

You might also like