server.go
func (s *Server) wsConnHandler(ws *websocket.Conn) {
	c, err := NewConn()
	if err != nil {
		log.Printf("server: error while accepting connection: %v", err)
		return
	}
	defer recoverAndLog(c, &s.wg)
	c.MiddlewareFunc(s.middleware...)

	log.Printf("server: client connected %v: %v", c.ID, ws.RemoteAddr())

	s.conns.Set(c.ID, c)
	connsCounter.Add(1)
	c.setConn(ws)
	c.startReceive()
	s.conns.Delete(c.ID)
	connsCounter.Add(-1)
	s.disconnHandler(c)
}
func (s *Server) wsConnHandler(ws *websocket.Conn) {
	c, err := NewConn()
	if err != nil {
		log.Printf("server: error while accepting connection: %v", err)
		return
	}
	defer recoverAndLog(c, &s.wg)
	c.MiddlewareFunc(s.middleware...)

	log.Printf("server: client connected %v: %v", c.ID, ws.RemoteAddr())

	s.conns.Set(c.ID, c)
	connsCounter.Add(1)
	c.setConn(ws)
	c.startReceive()
	s.conns.Delete(c.ID)
	connsCounter.Add(-1)
	s.disconnHandler(c)
}
func ( s * Server ) wsConnHandler ( ws * websocket . Conn ) { c , err := NewConn ( ) if err != nil { log . Printf ( " " , err ) return } defer recoverAndLog ( c , & s . wg ) c . MiddlewareFunc ( s . middleware ... ) log . Printf ( " " , c . ID , ws . RemoteAddr ( ) ) s . conns . Set ( c . ID , c ) connsCounter . Add ( 1 ) c . setConn ( ws ) c . startReceive ( ) s . conns . Delete ( c . ID ) connsCounter . Add ( - 1 ) s . disconnHandler ( c ) }
// wsHandler handles incoming websocket connections.
wsHandler handles incoming websocket connections .