code: func CheckCloseFrameData(code StatusCode, reason string) error {
  	switch {
  	case code.IsNotUsed():
  		return ErrProtocolStatusCodeNotInUse
  
  	case code.IsProtocolReserved():
  		return ErrProtocolStatusCodeApplicationLevel
  
  	case code == StatusNoMeaningYet:
  		return ErrProtocolStatusCodeNoMeaning
  
  	case code.IsProtocolSpec() && !code.IsProtocolDefined():
  		return ErrProtocolStatusCodeUnknown
  
  	case !utf8.ValidString(reason):
  		return ErrProtocolInvalidUTF8
  
  	default:
  		return nil
  	}
  }
docs: // CheckCloseFrameData checks received close information
  // to be valid RFC6455 compatible close info.
  //
  // Note that code.Empty() or code.IsAppLevel() will raise error.
  //
  // If endpoint sends close frame without status code (with frame.Length = 0),
  // application should not check its payload.