code: func NewV4Options(req *http.Request) (*V4Options, error) {
  	if !wsstream.IsWebSocketRequest(req) {
  		return &V4Options{}, nil
  	}
  
  	portStrings := req.URL.Query()[api.PortHeader]
  	if len(portStrings) == 0 {
  		return nil, fmt.Errorf("query parameter %q is required", api.PortHeader)
  	}
  
  	ports := make([]int32, 0, len(portStrings))
  	for _, portString := range portStrings {
  		if len(portString) == 0 {
  			return nil, fmt.Errorf("query parameter %q cannot be empty", api.PortHeader)
  		}
  		for _, p := range strings.Split(portString, ",") {
  			port, err := strconv.ParseUint(p, 10, 16)
  			if err != nil {
  				return nil, fmt.Errorf("unable to parse %q as a port: %v", portString, err)
  			}
  			if port < 1 {
  				return nil, fmt.Errorf("port %q must be > 0", portString)
  			}
  			ports = append(ports, int32(port))
  		}
  	}
  
  	return &V4Options{
  		Ports: ports,
  	}, nil
  }
docs: // NewV4Options creates a new options from the Request.