WebSocket protocol provides a way to exchange data between browser and server via a persistent connection Data can be passed in both directions as “packets”, w/o breaking the connection and additional HTTP-requests Great for online games, real-time trading systems and so on Create open a websocket connection prefer encrypted wss:// protocol, it’s like HTTPS for web sockets
let socket = new WebSocket("ws://javascript.info")
Send
socket.send(data)
Events We should listen to events on socket... 'message' data received 'error' websocket error 'close' connection closed