Gorilla WebSocket is a Go implementation of the WebSocket protocol.
The Gorilla WebSocket package provides a complete and tested implementation of the WebSocket protocol. The package API is stable.
go get github.com/gorilla/websocketthen in go.mod, add
replace github.com/gorilla/websocket v1.5.1 => github.com/adhocore/websocket v1.5.1
then run
go mod tidyimport "github.com/gorilla/websocket"
buf := []byte
// netConn is net.Conn instance
conn := websocket.NewConn(netConn, true, 2048, 2048, nil, nil, buf)The Gorilla WebSocket package passes the server tests in the Autobahn Test Suite using the application in the examples/autobahn subdirectory.