You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently there is no way to get a websocket.Conn object without leaving the handler, or
without having a handler at all. I need to wrap the websocket.Conn object for another
library, but not without maintaing a blocked go routine.
I suggest adding this method:
func (s Server) Upgrade(w http.ResponseWriter, req *http.Request) (conn *Conn, err
error) {
var rwc net.Conn
var buf *bufio.ReadWriter
if rwc, buf, err = w.(http.Hijacker).Hijack(); err != nil {
return nil, err
}
conn, err = newServerConn(rwc, buf, req, &s.Config, s.Handshake);
return
}