code: func (r *Reader) Read(p []byte) (n int, err error) {
  	if r.frame == nil {
  		if !r.fragmented() {
  			// Every new Read() must be preceded by NextFrame() call.
  			return 0, ErrNoFrameAdvance
  		}
  		// Read next continuation or intermediate control frame.
  		_, err := r.NextFrame()
  		if err != nil {
  			return 0, err
  		}
  		if r.frame == nil {
  			// We handled intermediate control and now got nothing to read.
  			return 0, nil
  		}
  	}
  
  	n, err = r.frame.Read(p)
  	if err != nil && err != io.EOF {
  		return
  	}
  	if err == nil && r.raw.N != 0 {
  		return
  	}
  
  	switch {
  	case r.raw.N != 0:
  		err = io.ErrUnexpectedEOF
  
  	case r.fragmented():
  		err = nil
  		r.resetFragment()
  
  	case r.CheckUTF8 && !r.utf8.Valid():
  		n = r.utf8.Accepted()
  		err = ErrInvalidUTF8
  
  	default:
  		r.reset()
  		err = io.EOF
  	}
  
  	return
  }
docs: // Read implements io.Reader. It reads the next message payload into p.
  // It takes care on fragmented messages.
  //
  // The error is io.EOF only if all of message bytes were read.
  // If an io.EOF happens during reading some but not all the message bytes
  // Read() returns io.ErrUnexpectedEOF.
  //
  // The error is ErrNoFrameAdvance if no NextFrame() call was made before
  // reading next message bytes.