code: func StartWSEndpoint(endpoint string, apis []API, modules []string, wsOrigins []string, exposeAll bool) (net.Listener, *Server, error) {
  
  	// Generate the whitelist based on the allowed modules
  	whitelist := make(map[string]bool)
  	for _, module := range modules {
  		whitelist[module] = true
  	}
  	// Register all the APIs exposed by the services
  	handler := NewServer()
  	for _, api := range apis {
  		if exposeAll || whitelist[api.Namespace] || (len(whitelist) == 0 && api.Public) {
  			if err := handler.RegisterName(api.Namespace, api.Service); err != nil {
  				return nil, nil, err
  			}
  			log.Debug("WebSocket registered", "service", api.Service, "namespace", api.Namespace)
  		}
  	}
  	// All APIs registered, start the HTTP listener
  	var (
  		listener net.Listener
  		err      error
  	)
  	if listener, err = net.Listen("tcp", endpoint); err != nil {
  		return nil, nil, err
  	}
  	go NewWSServer(wsOrigins, handler).Serve(listener)
  	return listener, handler, err
  
  }
docs: // StartWSEndpoint starts a websocket endpoint