code: func (cli *Client) Subscribe(opts *SubscribeOptions) error {
  	// Lock for reading and updating.
  	cli.muConn.Lock()
  
  	// Unlock.
  	defer cli.muConn.Unlock()
  
  	// Check the Network Connection.
  	if cli.conn == nil {
  		return ErrNotYetConnected
  	}
  
  	// Check the existence of the options.
  	if opts == nil || len(opts.SubReqs) == 0 {
  		return packet.ErrInvalidNoSubReq
  	}
  
  	// Define a Packet Identifier.
  	var packetID uint16
  
  	// Define an error.
  	var err error
  
  	// Lock for updating the Session.
  	cli.muSess.Lock()
  
  	defer cli.muSess.Unlock()
  
  	// Generate a Packet Identifer.
  	if packetID, err = cli.generatePacketID(); err != nil {
  		return err
  	}
  
  	// Create subscription requests for the SUBSCRIBE Packet.
  	var subReqs []*packet.SubReq
  
  	for _, s := range opts.SubReqs {
  		subReqs = append(subReqs, &packet.SubReq{
  			TopicFilter: s.TopicFilter,
  			QoS:         s.QoS,
  		})
  	}
  
  	// Create a SUBSCRIBE Packet.
  	p, err := packet.NewSUBSCRIBE(&packet.SUBSCRIBEOptions{
  		PacketID: packetID,
  		SubReqs:  subReqs,
  	})
  	if err != nil {
  		return err
  	}
  
  	// Set the Packet to the Session.
  	cli.sess.sendingPackets[packetID] = p
  
  	// Set the subscription information to
  	// the Network Connection.
  	for _, s := range opts.SubReqs {
  		cli.conn.unackSubs[string(s.TopicFilter)] = s.Handler
  	}
  
  	// Send the Packet to the Server.
  	cli.conn.send <- p
  
  	return nil
  }
docs: // Subscribe sends a SUBSCRIBE Packet to the Server.