This is app made with socket.io
which is used popularly to make web applications.
Actully as browser(client) and server are connected in uni-directional n/w. But it run only when browser(client) do some request then only server response to it.
But if we want that whenever server update then it should also respond automatically
and browser(client) should get that response without any refreshing.
So this is not possible in http request which generally is get/post only.
But this could be done using long polling but due to Advanced Functionality of WebSockets which provide full-duplex communication channels that to achieve
real-time data transfer and low latency AND
Long polling is sometimes considered only a half-real-time solution
and
also not ideal for high-traffic scenarios
or use cases that require real-time updates.
So here, we have two thing
- ws (web socket protocol)
- wss(web socket secure protocol)
while wss
connects on https only and ws
connects on http.
So, we will be using SOCKET.IO
which is two-way connection protocol.
Using this we can do something on the occurance of some event like as new user comes show their name and many things.
we will be using two different servers
- one for client
- other for server
Also this application store old chats (used local storage to do that)
Doing the frontend REACT.JS
in client
while server backend
installed socket.io express
- clone this repo
- open server folder and use
nodemon app.js
to connnect to the server - then open client folder and
npm start
for running frontend and use same localhost in new browser window
chat.application.mp4
Learning how to depoly 😞