Class: MQTT::Packet::Pubcomp

Inherits:
MQTT::Packet show all
Defined in:
lib/mqtt/packet.rb

Overview

Class representing an MQTT Publish Complete packet

Constant Summary

Constants inherited from MQTT::Packet

ATTR_DEFAULTS

Instance Attribute Summary

Attributes inherited from MQTT::Packet

#body_length, #flags, #id, #version

Instance Method Summary collapse

Methods inherited from MQTT::Packet

create_from_header, #initialize, #message_id, #message_id=, parse, parse_header, read, #to_s, #type_id, #type_name, #update_attributes, #validate_flags

Constructor Details

This class inherits a constructor from MQTT::Packet

Instance Method Details

#encode_bodyObject

Get serialisation of packet's body


746
747
748
# File 'lib/mqtt/packet.rb', line 746

def encode_body
  encode_short(@id)
end

#inspectObject

Returns a human readable string, summarising the properties of the packet


760
761
762
# File 'lib/mqtt/packet.rb', line 760

def inspect
  "\#<#{self.class}: 0x%2.2X>" % id
end

#parse_body(buffer) ⇒ Object

Parse the body (variable header and payload) of a packet


751
752
753
754
755
756
757
# File 'lib/mqtt/packet.rb', line 751

def parse_body(buffer)
  super(buffer)
  @id = shift_short(buffer)
  unless buffer.empty?
    raise ProtocolException.new("Extra bytes at end of Publish Complete packet")
  end
end