You can using this lib for client version 4.x and future lastest
import (
"net/http"
"github.com/doquangtan/socketio/v4"
)
func main() {
io := socketio.New()
io.OnConnection(func(socket *socketio.Socket) {
// ...
})
http.Handle("/socket.io/", io.HttpHandler())
http.ListenAndServe(":3000", nil)
}
This lib server for golang supported client version 3, 4
https://socket.io/docs/v4/client-installation/
In client just add:
<script src="/socket.io/socket.io.min.js"></script>
In general socket.io tutorial https://socket.io/docs/v4/client-initialization/