Web Sockets

HTTP uses 3 way handshake
if we are going to make lots of requests lets say for the price update on tradingview graph
then making these many number of requests in a second means for each request there is also that added 3 way handshake for every request made
that is why websockets gives us a persistant conncetion between the client and the server
PERFECT USECASE: a lot of data is coming and will keep on coming at very high frequency
 
 
in http a client makes a request and only then the server can respond back with a response
whereas in websockets a client can keep on sending multiple requests and the server can send multiple requests, like in messageing application (most common is socket.emit remember?)
 
 
notion image
notion image
notion image
REALTIME COMMUNICATION