code: func (s *clientIOSession) Flush() error {
  	buf := s.out
  	written := 0
  	all := buf.Readable()
  	for {
  		if written == all {
  			break
  		}
  
  		n, err := s.conn.Write(buf.buf[buf.readerIndex+written : buf.writerIndex])
  		if err != nil {
  			for _, sm := range s.svr.opts.middlewares {
  				sm.WriteError(err, s)
  			}
  			s.out.Clear()
  			return err
  		}
  
  		written += n
  	}
  
  	s.out.Clear()
  	return nil
  }
docs: // Flush writes bytes that in the internal bytebuf