what is websocket

in bot •  7 years ago  (edited)

WebSocket is a communications protocol for a persistent, bi-directional, full duplex TCP connection from a user’s web browser to a server and an advanced technology that allows real-time interactive communication between the client browser and a server.
image
It uses a completely different protocol that allows bidirectional data flow, making it unique against HTTP. Web Sockets on the other hand don’t need you to send a request in order to respond. They allow bidirectional data flow so you just have to listen for any data.
image


With WebSockets you can transfer as much data as you like without incurring the overhead associated with traditional HTTP requests. One of the obstructions to building web applications that handle rapidly changing content (think status updates. In the race for micro-optimizations of such behavior sites eventually hit a wall in which the browser must continually poll the server for updates. ![image]() Web Sockets are currently one of the ‘next big web technologies’ adopted by many developers. Great for real-time interactions, even including online games.
They are so useful you could be amazed you haven’t heard of it before, but did you know that libraries like Firebase are already using Web Sockets. ![image]() With WebSockets, data sent from the server triggers a browser event. For example, rather than checking every two seconds for a new chat message, the browser can use an event-driven approach that triggers when a WebSocket connection delivers new data from the server.
Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!