func (p *PUBLISH) setVariableHeader() {
	p.variableHeader = appendLenStr(p.variableHeader, p.TopicName)
	if p.QoS != mqtt.QoS0 {
		p.variableHeader = append(p.variableHeader, encodeUint16(p.PacketID)...)
	}
}
setVariableHeader sets the variable header to the Packet.
package packet
import (
	"errors"
	"github.com/yosssi/gmq/mqtt"
)
const maxRemainingLength = 268435455
const minLenPUBLISHFixedHeader = 2
const minLenPUBLISHVariableHeader = 2
var ErrInvalidPacketID = errors.New("invalid Packet Identifier")
type PUBLISH struct {
	base
	DUP bool
	QoS byte
	retain bool
	TopicName []byte
	PacketID uint16
	Message []byte
}
func (p *PUBLISH) setFixedHeader() {
	b := TypePUBLISH << 4
	if p.DUP {
		b |= 0x08
	}
	b |= p.QoS << 1
	if p.retain {
		b |= 0x01
	}
	p.fixedHeader = append(p.fixedHeader, b)
	p.appendRemainingLength()
}