websocket is a minimal and idiomatic WebSocket library for Go. Minimal and idiomatic API. First class context.Context support. Fully passes the WebSocket autobahn-testsuite. Single dependency. JSON and protobuf helpers in the wsjson and wspb subpackages. Zero alloc reads and writes. Concurrent writes. Close handshake. net.Conn wrapper. Ping pong API. RFC 7692 permessage-deflate compression. Compile to Wasm. Transparent message buffer reuse with wsjson and wspb subpackages. Gorilla writes directly to a net.Conn and so duplicates features of net/http.Client. Gorilla requires registering a pong callback before sending a Ping. Compare godoc of nhooyr.io/websocket with gorilla/websocket side by side. Will enable easy HTTP/2 support in the future.
Features
- Mature and widely used
- Prepared writes
- Configurable buffer sizes
- Minimal and idiomatic API
- Zero alloc reads and writes
- Full context.Context support
- Transparent message buffer reuse with wsjson and wspb subpackages