Undertstanding WebSockets #javascript #code #tips

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
ever wondered how companies like slack or Discord enable realtime communication they use something called websocket and I think it's something that every developers should know with regular HTTP requests the client sends a request to the server and the server sends a response but with websockets after the initial request and response the connection stays open meaning the client or the server can send messages at any time let's go through how to create a simple websocket server first you'll need to install a package called WS then make a connection which will allow you to send and receive messages for the client you can use the browsers built in websocket API by connecting to a URL with WS instead of HTTP you can send messages using the send method and listen for messages using on message now you can send messages back and forth between the client and server in real time
Info
Channel: Better Stack
Views: 9,759
Rating: undefined out of 5
Keywords:
Id: dr4ZyNRLp-c
Channel Id: undefined
Length: 0min 50sec (50 seconds)
Published: Tue Jul 02 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.