We all have used Instagram or WhatsApp to have a healthy chat with our friends. Being a developer, I always wondered how this happens so fast without reloading. The answer is Web Sockets.
Web Sockets vs HTTP
Why Web Sockets you might ask? Well what happens in HTTP is that a connection is established and once the request result process is completed, the connection is terminated.
So if we use this process for real time messaging, it would take some time to create new connections, thus making our chatting process slower. No one would like that, right?
This is where Web Sockets come in. The major difference is that the connection once established, is not destroyed until there is no more need for it.
Pipelines in Web Sockets
This might feel like one of those tech terminologies which scare us. But in simpler terms, pipelines in tech are same as real life pipelines. A connection through which things can be passed in any direction easily.
This is how Web Sockets work, through pipelines.
There are many libraries that help with the implementation of Web Sockets like Socket.io
Top comments (2)
Would have loved if the topic was elaborated a bit more. Nevertheless, a great thing to get educated with. Well Done!
Will try to be more detailed next time!
Thanks for your feedback