Skip to main content
Version: 1.8

wshub

A production-ready, scalable WebSocket package for Go with support for rooms, broadcasting, multi-node clustering, middleware, hooks, and extensibility.

wshub is pure infrastructure. It manages connections, rooms, and message routing — you bring the business logic.

go get github.com/KARTIKrocks/wshub

What you get

Production-readyProper concurrency, graceful shutdown and drain, error handling
Horizontally scalableMulti-node support via adapters (Redis, NATS, or your own)
PluggableBring your own logger and metrics collector
MiddlewareChain handlers with cross-cutting logic
Lifecycle hooksHook into connection, message, room, and backpressure events
RoomsGroup clients for targeted broadcasting
ObservabilityBuilt-in interfaces plus an official Prometheus subpackage
LimitsConnection, room, and token-bucket rate limits
BackpressureConfigurable drop policies with notification hooks
Health probes/healthz and /readyz handlers for Kubernetes
Thread safeEvery method is safe for concurrent use

Where to go next

Documentation layout

These guides explain concepts, patterns, and configuration. For exact type signatures, method sets, and struct fields, use pkg.go.dev — it is generated from the source and is always authoritative.

Requirements

Go 1.27 or later. Changed in 1.8. Previously Go 1.22 or later.