DEV Community


SocketCluster. The most underrated framework. Part 1: Intoduction

A Belgian native living in Brazil
・2 min read

Part 1: An introduction to SocketCluster and its potential

What is SocketCluster?

SocketCluster is a framework which allows you to use the WebSocket protocol to transmit between its backend API and client library. The client can be used both on a backend (E.g. a Raspberry pi) or frontend application.

What you can expect of these articles

These articles should give you a good insight of how to use a scalable SocketCluster application and how to deploy it to a Cloud service. I will try to keep it beginner friendly for everyone that has knowledge in JavaScript.

What SocketCluster solves and which applications it can be used for

Unlike REST where there is a learning curve to fully understand the HTTP Protocol or GraphQL where it's needed to learn the fundamentals of schemas, SocketCluster lets you use its framework without actually knowing how sockets work. Nor does it really need to. The framework perfectly handles sockets in a way you just need to transfer data. You can any type of data e.g. objects, strings, buffers, ... It in some way resembles SocketIO. You could say its SocketIO on steroids. It comes with bulkier tools and scalability out of the box. It has prewritten Kubernetes files.

Its internals

This is pretty technical and can be skipped.

The latest version of SocketCluster uses the for await loop which was recently introduced in JavaScript. The internals create queues that consume data asynchronously. Let's take an example where this is useful.

E.g. the EventEmitter in JavaScript might execute a callback twice. A good example is finalizing a delete operation in a SQL Database.

Projects/companies that use SC


One of the most famous success stories is the Lisk protocol. A cryptocurrency blockchain written in JavaScript using SocketCluster as its peer-to-peer protocol. At the time of writing Lisk is ranked #99 globally according to Coin Market Cap. Here are [1][2] articles related to SocketCluster on LiskHQ's GitHub.

Redux dev tools

Another example is Redux dev tools. They use SocketCluster to remote monitoring.


Here you can find an article of their reasons why. The difficulties they had over SocketIO and why SocketCluster was a better fit.

What we will be building

We will build a full-fledged application which has much resemblance to the current problems in the world, the pandemic. We will build a contact tracing app which in theory should really scale. The technologies we will be using:

  • Vue 3 with the Composition API as the frontend
  • PostgreSQL as the database
  • Knex.js as the query builder

Additionally I'll provide a deeper insight into Vue 3's Composition API as its fairly new technology.

Discussion (0)