class MQTT::Packet::Subscribe

def encode_body

Get serialisation of packet's body
def encode_body
  raise 'no topics given when serialising packet' if @topics.empty?
  body = encode_short(@id)
  topics.each do |item|
    body += encode_string(item[0])
    body += encode_bytes(item[1])
  end
  body
end