Get the latest tech news

You might not need WebSockets


Websockets are powerful tools that have become a fan-favorite for building realtime applications, but you might be using them for all the wrong reasons. Let's explore the pitfalls of websockets and how we can use plain old HTTP to get the same job done.

If you’re new to web development or you haven’t heard of a WebSocket before, they’re a way to open a two-way communication channel between the client and server using HTTP as the transport protocol. Because of how it’s advertised on the tin, it’s natural to think of a WebSocket as the best (and sometimes only) way to orchestrate a long-living stream of data between client and server, like for instance a real time application. The extra complexity of a WebSocket’s lifecycle is one of the main reasons you might not need it—unless there’s absolutely no alternative to socket based messaging (partially demonstrated in the previous section), then you’re better off with a simpler communication pattern.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of websockets

websockets

Related news:

News photo

Yaak 2.0 – Git, WebSockets, OAuth, and More

News photo

The hidden complexity of scaling WebSockets

News photo

Back to basics: Why we chose long-polling over websockets