// the find
olahol/melody
:notes: Minimalist websocket framework for Go
Melody is a thin layer on top of gorilla/websocket that handles session management, broadcasting, ping/pong heartbeats, and per-session key-value storage. It targets developers who want the gorilla primitives without writing the same hub boilerplate for the fifth time. The API mirrors net/http handler style, so it fits naturally into existing Go HTTP projects.
The session.Set/Get store is genuinely useful — avoids the common mistake of closing over mutable state in closures. Broadcast and BroadcastFilter cover most real-world fanout patterns without requiring you to manage a channel hub yourself. Message buffers mean concurrent writes don't race, which is a real footgun gorilla/websocket leaves to you. Test coverage is solid and the CI badge reflects an active test suite, not theatre.
Gorilla/websocket itself is in maintenance mode, and melody inherits that dependency — nhooyr/websocket or gobwas/ws are better foundations for new projects. There's no built-in room or channel concept; BroadcastFilter works but putting multi-room logic on the caller gets messy fast. No support for binary framing beyond raw []byte — if you're building anything protocol-aware (e.g. protobuf over WebSocket), you're on your own. The session store is an untyped interface{} map, so type assertions are everywhere and there's no way to enforce keys at compile time.