Alexandru Curiman

A chat app built on WebSockets and a Go server: public rooms, private conversations, typing indicators and online status, plus voice notes recorded right in the browser.

Year
2024
Role
design, backend, frontend
Status
live

Overview

Messages are delivered over WebSockets through a Go hub that fans each message out to the right room or private conversation. Presence, typing indicators and online status ride on the same connection.

Audio messages are recorded in the browser with the MediaRecorder API, sent as a dedicated message action, and played back inline, so the chat works as well for voice notes as for text.

The interface is responsive and keyboard friendly, and the API is small enough to be a reference for anyone wanting to add real-time features to a Go backend.

Features

Under the hood

  1. A central chat server keeps the set of connected clients and rooms.
  2. Each client has a read and a write goroutine; messages are JSON with an action field such as send-message or join-room.
  3. Rooms broadcast to their members; private rooms are regular rooms limited to two users.
  4. The server, client, room and message packages each have their own tests.

Built with

  • Go
  • WebSockets
  • JavaScript
  • MediaRecorder API

What I learned

  • The hub and per-client goroutine pattern keeps the concurrency manageable: no shared state outside the hub.
  • Designing the message actions first made the frontend and backend easy to build independently.
  • Audio over WebSockets works fine for short clips; anything longer should go over HTTP.