Hysen Labs
Open-source project
joncody/roomer avatar
joncody

roomer

Concurrent, room-based WebSocket messaging server and pub/sub hub written in Go.

28 stars5 forksJavaScriptMIT
DEEP OPEN-SOURCE ANALYSIS

roomer builds room based WebSocket messaging in Go

roomer is a Go WebSocket framework with a JavaScript client that handles rooms, binary framing, clustering, and observability.

Design centered on rooms

roomer is a WebSocket framework where the central idea is the room. Connections join named rooms, and the server manages creation, membership, and cleanup so that empty rooms are removed automatically. The server is written in Go and targets Go 1.21 or newer, while the client is plain JavaScript with zero dependencies, which the project highlights as a deliberate choice to keep browser and Node integrations light. Messages are routed explicitly rather than broadcast blindly, and the protocol uses length prefixed binary framing with direct slice decoding and single allocation serialization for low latency. The README states the framing is zero copy, meaning data is read straight from the buffer without extra passes. A formal specification written in TLA+ backs the concurrency design, which is unusual for a project of this size and signals that the authors reasoned about correctness before coding. For an application developer, the room abstraction means presence, fan out, and per room state are handled by the framework instead of being rebuilt for every new real time feature. The explicit routing also means a message goes to the rooms that should see it rather than every socket, which keeps bandwidth down as a system grows. The combination of a small client, a typed server API, and a verified protocol model makes roomer feel closer to a library you build on than a toy example, and the README presents the TLA+ file as part of the repo rather than as separate documentation that could drift from the code. This foundation is what the rest of the feature set builds on.

Scaling across nodes

The server separates the in memory default from pluggable cluster adapters so a single node and a multi node deployment share the same API. The included adapters target Redis, NATS, and Kafka as pub/sub backbones, while the zero dependency in memory adapter covers local development and small deployments. When a distributed adapter is used, the framework filters node self echoes so a client never receives a message it just sent, a behavior the README calls loopback suppression. This matters because without it, multi node setups duplicate traffic and confuse clients, and debugging duplicate delivery is painful in production. Graceful shutdown is built in at the package level: Shutdown drains queues, sends WebSocket 1001 Going Away close frames, and cleans up active connections within a deadline context. The hub partitions connections and rooms across 32 lock striped shards using FNV-1a hashing, which the authors document as a way to avoid contention on many CPU cores. These choices together address the parts of real time infrastructure that are easy to get wrong, namely ordering, duplication, and shutdown. A team can therefore start on the in memory adapter and later point the same code at a Redis or Kafka cluster without rewriting the message handling. The README frames this as enterprise grade, and the specific mechanisms named above are what give that claim substance rather than marketing weight.

Observability and logging

Production use needs visibility, and roomer ships telemetry hooks for Prometheus and OpenTelemetry that instrument connections, room counts, byte throughput, and drop events. The metrics surface lets operators plot traffic and spot stalled rooms or sudden disconnect bursts without adding instrumentation by hand. Logging is wired to Go's structured log/slog package, with configurable handlers and log levels, so output fits an existing structured logging pipeline. The combination of metrics and structured logs means the framework reports on itself instead of relying on external probes that guess at internal state. The client side stays dependency free, which keeps bundle size and supply chain surface small for frontend teams who do not want to pull extra packages into the browser. The project is published under the MIT license and documents its API through pkg.go.dev, so the server and client can be adopted in commercial and open source code without licensing friction. For teams evaluating a WebSocket layer, roomer presents a focused feature set, rooms, binary framing, clustering, and observability, rather than a broad application platform that hides the hard parts. The explicit mention of client dependencies being zero is a concrete promise the README backs with a badge, and the TLA+ spec, the lock striped hub, and the loopback suppression are the details that show the authors cared about the failure modes that appear only once a service is under real load.

Editorial conclusion

The framework is released under the MIT license and is written in Go for the server with a dependency free JavaScript client.

DEEP OPEN-SOURCE ANALYSIS

Official sources

Community notes

Community notes