# Dietbox Realtime — Live updates as a service of its own, so they ship on their own clock.

> A small realtime server that holds the open connections: a room per user, a shared-secret handshake, and one endpoint the platform posts to when something needs pushing. Separate from the product because long-lived connections and request traffic do not scale on the same axis — and because the monolith deployed once a night.

## Overview

Thirty-four commits over two months in 2022, for a service that has outlived both: a socket server that holds every open connection, joins each client to a room named for its user id, and exposes one endpoint the rest of the platform posts to when something needs pushing out. It sits outside the product because a long-lived connection and a request are not the same kind of traffic.

## Stack

- Node
- Express
- Socket.IO
- Application Insights
- Azure App Service
- Azure DevOps

## Highlights

- The notify endpoint the rest of the platform posts to when something needs pushing out.
- An info endpoint reporting the live connection count, for monitoring.
- A health endpoint reporting its own latency.
- A shared-secret handshake that disconnects a client immediately if it ends up joined to no room.

## Role

Senior Software Engineer · 2022. Closed-source professional work — the write-up describes it without the source.

---

Source: https://felipealmeida.tech/projects/dietbox-realtime
