code: func NewWebSocketServer(listener net.Listener) *WebSocketServer {
  	// create server
  	ws := &WebSocketServer{
  		listener: listener,
  		upgrader: &websocket.Upgrader{
  			HandshakeTimeout: 60 * time.Second,
  			Subprotocols:     []string{"mqtt", "mqttv3.1"},
  		},
  		incoming: make(chan *WebSocketConn),
  	}
  
  	// add check origin method that uses the optional check origin function
  	ws.upgrader.CheckOrigin = func(r *http.Request) bool {
  		if ws.originChecker != nil {
  			return ws.originChecker(r)
  		}
  
  		return true
  	}
  
  	// create http server
  	h := &http.Server{
  		Handler: http.HandlerFunc(ws.requestHandler),
  	}
  
  	// serve http traffic in background
  	ws.tomb.Go(func() error {
  		return h.Serve(ws.listener)
  	})
  
  	return ws
  }
docs: // NewWebSocketServer wraps the provided listener.