WebSocket in 2025

Hi guys,

is this still the go-to lib for websockets?

GitHub - gorilla/websocket: Package gorilla/websocket is a fast, well-tested and widely used WebSocket implementation for Go.

Are there alternatives out?

It’s still not in the std lib, correct?

It is the first time I need them. :sweat_smile:

Thanks & KR
Karl

You can find a bunch of go packages links in GitHub - avelino/awesome-go: A curated list of awesome Go frameworks, libraries and software.
Also get basic information from The WebSocket API (WebSockets) - Web APIs | MDN
HTH

The docs from x/net/websocket still suggest gorilla or https://github.com/coder/websocket. I’ve used gorilla semi-recently and it was easy to use and reason about and I’d probably use it again. Check out this repo for a little demo I built using gorilla and client-side code that interfaces with it.

OK - but all that having been said, this project looks interesting:

Abstractions built on top of websockets. It has a JS lib to go with it, and Grafana is using it. The docs look good and the examples are extensive. Only downside is: no v1 yet so no compatibility guarantee (but I can’t imagine they are breaking things too often if Grafana is built on it!).

Here are some discussions about this topic with even more options:

https://www.reddit.com/r/golang/comments/zu80o0/gorillawebsocket_or_melody/

https://www.reddit.com/r/golang/comments/1cq61io/which_librarys_websocket_to_use/

In summary: I don’t think there is a definitive answer here, unfortunately. Pick something with a license that works for you and docs / examples that appeal to you.

1 Like