Riding the WebSockets Wave

Ahoy, fellow adventurers of the digital realm! Today, we embark on a thrilling journey to explore the magical realm of WebSockets – a technology that promises to revolutionize the way we interact with the web. Imagine a world where real-time communication, interactive experiences, and seamless updates are the norm. Well, no need to dream, because with WebSockets, we're already there! So, grab your virtual surfboards, and let's catch the wave of WebSockets together!

Before we begin, we need to understand why even board this boat of Websocket. In order to reach the web socket, we will need to review its ancestors.
Once upon a time, we had a protocol named HTTP 1.0. It was wonderful but with one small problem. It was lazy and obese like me and tried to rest as soon as it get the opportunity. Let's say it has to serve 10 images, It would serve 1 and then close the connection and take a rest. Then again open the connection, and serve another. Opening and closing connections come with lots of overheads. This makes the whole process ineffective.

HTTP 1.1, introduced in 1997, brought significant improvements to its predecessor, HTTP 1.0. It introduced features like persistent connections (keep-alive) and pipelining, which helped reduce the overhead of establishing new connections for each request and made the web experience faster and more efficient.

However, there was still one crucial limitation with HTTP 1.1 - it was inherently stateless. Once a response was sent from the server to the client, the connection was closed, severing the line of communication. This forced developers to resort to workarounds like AJAX (Asynchronous JavaScript and XML) to achieve some level of interactivity and real-time updates in web applications.

The Birth of WebSockets: Bridging the Gap

The need for a better way to handle real-time, bidirectional communication on the web led to the creation of WebSockets. In 2008, Ian Hickson, a Google engineer, first proposed the idea of WebSockets as a new standard in the Web Applications 1.0 Working Draft.

WebSockets were designed to provide a full-duplex, bidirectional communication channel between the client and the server, overcoming the limitations of HTTP. With WebSockets, a persistent connection could be established using a single TCP handshake, allowing data to flow freely in both directions. This meant that servers could initiate communication and send updates to clients, and vice versa, without the need for clients to keep making requests.

HTTP 2.0: A Surfer's Paradise

Around the same time, HTTP 2.0 was also in development. HTTP 2.0 brought several performance improvements, including multiplexing, header compression, and server push. Although these improvements made HTTP more efficient, they were not enough to replace WebSockets entirely.

WebSockets continued to shine for use cases requiring real-time, bidirectional communication, as well as applications that demanded persistent connections for continuous data flow.

FastAPITutorial

Brige the gap between Tutorial hell and Industry. We want to bring in the culture of Clean Code, Test Driven Development.

We know, we might make it hard for you but definitely worth the efforts.

Contacts

Refunds:

Refund Policy
Social

Follow us on our social media channels to stay updated.

© Copyright 2022-23 Team FastAPITutorial