object
mqtt
Portable MQTT 5 client predicates using http_transport_protocol implementations.
logtalk_load(mqtt(loader))static, context_switching_callsPublic predicates
connect/3
Opens a transport connection for an MQTT or MQTT-over-TLS address and completes the MQTT CONNECT/CONNACK exchange.
staticconnect(Address,Connection,Options)connect(+atom,--compound,+list) - one_or_errorAddress is a variable:instantiation_errorAddress is neither a variable nor an atom:type_error(atom,Address)Address is an atom but not a valid MQTT address:domain_error(mqtt_address,Address)domain_error(mqtt_connack_reason_code,ReasonCode)domain_error(mqtt_packet,expected(connack,Packet))connect/4
Opens a transport connection to the given host and port and completes the MQTT CONNECT/CONNACK exchange. The scheme/1 option selects MQTT over TCP or TLS.
staticconnect(Host,Port,Connection,Options)connect(+atom,+integer,--compound,+list) - one_or_errorHost or Port is a variable:instantiation_errorHost is neither a variable nor an atom:type_error(atom,Host)Port is neither a variable nor an integer:type_error(integer,Port)Port is a negative integer:domain_error(non_negative_integer,Port)domain_error(mqtt_connack_reason_code,ReasonCode)domain_error(mqtt_packet,expected(connack,Packet))disconnect/2
Closes an MQTT transport connection. MQTT DISCONNECT packet exchange will be layered on this transport operation.
staticdisconnect(Connection,Options)disconnect(+compound,+list) - one_or_errorOptions is a variable or a partial list:instantiation_errorOptions is neither a variable nor a list:type_error(list,Options)Option of the list Options is not a valid option:domain_error(option,Option)connection_alive/1
True if the term is an MQTT connection handle created by this object.
staticconnection_alive(Connection)connection_alive(+compound) - zero_or_onepacket_type/2
Table of MQTT control packet type names and numeric codes.
staticpacket_type(Type,Code)packet_type(?atom,?integer) - zero_or_morereason_code/3
Table of MQTT reason code names and numeric codes by packet type.
staticreason_code(PacketType,Name,Code)reason_code(?atom,?atom,?integer) - zero_or_morepublish/4
Publishes a message and waits synchronously for the required MQTT acknowledgement.
staticpublish(Connection,Topic,Payload,Options)publish(+compound,+atom,+term,+list) - one_or_errorTopic is not a valid MQTT topic name:domain_error(mqtt_topic_name,Topic)Options contains an invalid packet identifier:domain_error(mqtt_packet_identifier,PacketIdentifier)Options contains an invalid QoS value:domain_error(mqtt_qos,QoS)domain_error(mqtt_packet,expected(Type-PacketIdentifier,Packet))subscribe/4
Subscribes to topic filters and waits synchronously for the matching SUBACK.
staticsubscribe(Connection,TopicFilters,Result,Options)subscribe(+compound,+list,--list,+list) - one_or_errorTopicFilters is empty:domain_error(mqtt_subscriptions,[])TopicFilter is not a valid MQTT topic filter:domain_error(mqtt_topic_filter,TopicFilter)Options contains invalid subscription options:domain_error(mqtt_subscription_options,Byte)domain_error(mqtt_packet,expected(suback-PacketIdentifier,Packet))unsubscribe/4
Unsubscribes from topic filters and waits synchronously for the matching UNSUBACK.
staticunsubscribe(Connection,TopicFilters,Result,Options)unsubscribe(+compound,+list,--list,+list) - one_or_errorTopicFilters is empty:domain_error(mqtt_topic_filters,[])TopicFilter is not a valid MQTT topic filter:domain_error(mqtt_topic_filter,TopicFilter)domain_error(mqtt_packet,expected(unsuback-PacketIdentifier,Packet))receive/3
Receives the next MQTT packet.
staticreceive(Connection,Message,Options)receive(+compound,--compound,+list) - one_or_errordomain_error(mqtt_packet_stream,unexpected_end_of_file)domain_error(mqtt_packet,Packet)send_pingreq/1
Sends a PINGREQ packet.
staticsend_pingreq(Connection)send_pingreq(+compound) - one_or_errorresource_error(mqtt_packet_stream)ping/2
Sends PINGREQ and waits synchronously for PINGRESP.
staticping(Connection,Options)ping(+compound,+list) - one_or_errordomain_error(mqtt_packet_stream,unexpected_end_of_file)domain_error(mqtt_packet,expected(pingresp,Packet))encode_packet/2
Encodes a normalized MQTT packet term.
staticencode_packet(Packet,Bytes)encode_packet(+compound,--list(integer)) - one_or_errorPacket contains an invalid MQTT field value:domain_error(mqtt_packet,Packet)Packet has a packet type that is not yet supported:resource_error(mqtt_packet_support)decode_packet/2
Decodes bytes into a normalized MQTT packet term.
staticdecode_packet(Bytes,Packet)decode_packet(+list(integer),--compound) - one_or_errorBytes contains an invalid MQTT packet encoding:domain_error(mqtt_packet,Bytes)Bytes contains bytes after the encoded packet:domain_error(mqtt_packet_trailing_bytes,Rest)Bytes encodes a packet type that is not yet supported:resource_error(mqtt_packet_support)Protected predicates
(no local declarations; see entity ancestors if any)
Private predicates
resolve_address/4
Resolves an MQTT address into scheme, host, and port.
staticresolve_address(Address,Scheme,Host,Port)resolve_address(+atom,-atom,-atom,-integer) - one_or_errorAddress is a variable:instantiation_errorAddress is neither a variable nor an atom:type_error(atom,Address)Address is an atom but not a valid MQTT address:domain_error(mqtt_address,Address)Address contains an invalid authority:domain_error(mqtt_address_authority,Authority)resolve_transport/3
Resolves an explicit or default transport object for the given MQTT scheme.
staticresolve_transport(Scheme,Transport0,Transport)resolve_transport(+atom,+object_identifier,-object_identifier) - one_or_errorTransport0 is a variable:instantiation_errorTransport0 is neither a variable nor an existing object:existence_error(object,Transport0)Transport0 does not implement http_transport_protocol:domain_error(http_transport_protocol_object,Transport0)Transport0 does not support Scheme:consistency_error(mqtt_options,scheme(Scheme),transport(Transport0))append_tls_transport/3
Adds connection_transport(tls) to connection options for MQTT-over-TLS unless already specified.
staticappend_tls_transport(Scheme,Options,OptionsWithTransport)append_tls_transport(+atom,+list,-list) - one_or_errorwrite_packet/2
Encodes and writes an MQTT packet to a binary output stream.
staticwrite_packet(Output,Packet)write_packet(+stream,+compound) - one_or_errorPacket is not a supported normalized MQTT packet:resource_error(mqtt_packet_support)Output cannot be written or flushed:resource_error(mqtt_packet_stream)read_packet/2
Reads and decodes one MQTT packet from a binary input stream.
staticread_packet(Input,Packet)read_packet(+stream,--compound) - one_or_errorInput ends before a complete packet is read:domain_error(mqtt_packet_stream,unexpected_end_of_file)Input contains an invalid MQTT packet encoding:domain_error(mqtt_packet,Packet)encode_uint8/2
Encodes an unsigned 8-bit integer.
staticencode_uint8(Value,Bytes)encode_uint8(+integer,-list(integer)) - one_or_errorValue is a variable:instantiation_errorValue is neither a variable nor an integer:type_error(integer,Value)Value is outside the unsigned 8-bit integer range:domain_error(between(0,255),Value)decode_uint8/3
Decodes an unsigned 8-bit integer.
staticdecode_uint8(Bytes,Value,Rest)decode_uint8(+list(integer),-integer,-list(integer)) - one_or_errorBytes is not a byte:type_error(byte,Byte)encode_uint16/2
Encodes an unsigned 16-bit integer in network byte order.
staticencode_uint16(Value,Bytes)encode_uint16(+integer,-list(integer)) - one_or_errorValue is a variable:instantiation_errorValue is neither a variable nor an integer:type_error(integer,Value)Value is outside the unsigned 16-bit integer range:domain_error(between(0,65535),Value)decode_uint16/3
Decodes an unsigned 16-bit integer in network byte order.
staticdecode_uint16(Bytes,Value,Rest)decode_uint16(+list(integer),-integer,-list(integer)) - one_or_errorBytes is not a byte:type_error(byte,Byte)encode_uint32/2
Encodes an unsigned 32-bit integer in network byte order.
staticencode_uint32(Value,Bytes)encode_uint32(+integer,-list(integer)) - one_or_errorValue is a variable:instantiation_errorValue is neither a variable nor an integer:type_error(integer,Value)Value is outside the unsigned 32-bit integer range:domain_error(between(0,4294967295),Value)decode_uint32/3
Decodes an unsigned 32-bit integer in network byte order.
staticdecode_uint32(Bytes,Value,Rest)decode_uint32(+list(integer),-integer,-list(integer)) - one_or_errorBytes is not a byte:type_error(byte,Byte)encode_varint/2
Encodes an MQTT variable byte integer.
staticencode_varint(Value,Bytes)encode_varint(+integer,-list(integer)) - one_or_errorValue is a variable:instantiation_errorValue is neither a variable nor an integer:type_error(integer,Value)Value is outside the MQTT variable byte integer range:domain_error(between(0,268435455),Value)decode_varint/3
Decodes an MQTT variable byte integer, rejecting non-minimal encodings and overflows.
staticdecode_varint(Bytes,Value,Rest)decode_varint(+list(integer),-integer,-list(integer)) - one_or_errorBytes does not start with a valid, minimally encoded MQTT variable byte integer:domain_error(mqtt_variable_byte_integer,Consumed)encode_utf8_string/2
Encodes an MQTT UTF-8 encoded string with a two-byte length prefix.
staticencode_utf8_string(String,Bytes)encode_utf8_string(+atom,-list(integer)) - one_or_errorString is a variable:instantiation_errorString is neither a variable nor atom:type_error(atom,String)String is not a valid MQTT UTF-8 string:domain_error(mqtt_utf8_string,Codes)decode_utf8_string/3
Decodes an MQTT UTF-8 encoded string with a two-byte length prefix.
staticdecode_utf8_string(Bytes,String,Rest)decode_utf8_string(+list(integer),-atom,-list(integer)) - one_or_errorBytes does not start with a valid MQTT UTF-8 string:domain_error(mqtt_utf8_string,Codes)encode_binary_data/2
Encodes MQTT binary data with a two-byte length prefix.
staticencode_binary_data(Data,Bytes)encode_binary_data(+list(integer),-list(integer)) - one_or_errorData is not a list of bytes:type_error(list(byte),Data)Data is longer than 65535 bytes:domain_error(between(0,65535),Length)decode_binary_data/3
Decodes MQTT binary data with a two-byte length prefix.
staticdecode_binary_data(Bytes,Data,Rest)decode_binary_data(+list(integer),-list(integer),-list(integer)) - one_or_errorBytes do not encode a valid length:type_error(byte,Byte)encode_utf8_string_pair/2
Encodes an MQTT UTF-8 string pair as two MQTT UTF-8 encoded strings.
staticencode_utf8_string_pair(Pair,Bytes)encode_utf8_string_pair(+compound,-list(integer)) - one_or_errorPair is not an atom:type_error(atom,String)Pair is not a valid MQTT UTF-8 string:domain_error(mqtt_utf8_string,Codes)decode_utf8_string_pair/3
Decodes an MQTT UTF-8 string pair from two MQTT UTF-8 encoded strings.
staticdecode_utf8_string_pair(Bytes,Pair,Rest)decode_utf8_string_pair(+list(integer),-compound,-list(integer)) - one_or_errorBytes does not start with two valid MQTT UTF-8 strings:domain_error(mqtt_utf8_string,Codes)encode_properties/2
Encodes an MQTT property list with its variable byte integer length prefix.
staticencode_properties(Properties,Bytes)encode_properties(+list,-list(integer)) - one_or_errorProperties is a variable or a partial list:instantiation_errorProperties is neither a variable nor a list:type_error(list,Properties)Property is not a supported MQTT property:domain_error(mqtt_property,Property)decode_properties/3
Decodes an MQTT property list and returns the remaining packet bytes.
staticdecode_properties(Bytes,Properties,Rest)decode_properties(+list(integer),-list,-list(integer)) - one_or_errorBytes does not contain the declared property bytes:domain_error(mqtt_properties,Bytes)Bytes contains an unknown property identifier:domain_error(mqtt_property_identifier,Identifier)encode_property_list/2
Encodes MQTT properties without the property length prefix.
staticencode_property_list(Properties,Bytes)encode_property_list(+list,-list(integer)) - one_or_errorProperty is not a supported MQTT property:domain_error(mqtt_property,Property)decode_property_list/2
Decodes MQTT properties from a property body byte list.
staticdecode_property_list(Bytes,Properties)decode_property_list(+list(integer),-list) - one_or_errorBytes contains an unknown property identifier:domain_error(mqtt_property_identifier,Identifier)encode_property/2
Encodes a single MQTT property.
staticencode_property(Property,Bytes)encode_property(+compound,-list(integer)) - one_or_errorProperty is not a supported MQTT property:domain_error(mqtt_property,Property)Property contains an invalid value:domain_error(mqtt_property_value,Name-Value)decode_property/3
Decodes a single MQTT property.
staticdecode_property(Bytes,Property,Rest)decode_property(+list(integer),-compound,-list(integer)) - one_or_errorBytes starts with an unknown property identifier:domain_error(mqtt_property_identifier,Identifier)Bytes contains an invalid property value:domain_error(mqtt_property_value,Name-Value)mqtt_property/3
Table of MQTT property names, identifiers, and value types.
staticmqtt_property(Name,Identifier,Type)mqtt_property(?atom,?integer,?atom) - zero_or_moreencode_fixed_header/4
Encodes an MQTT fixed header from packet type, flags, and remaining length.
staticencode_fixed_header(Type,Flags,RemainingLength,Bytes)encode_fixed_header(+atom,+integer,+integer,-list(integer)) - one_or_errorType is not a supported MQTT packet type:domain_error(mqtt_packet_type,Type)Flags is invalid for Type:domain_error(mqtt_fixed_header_flags,Type-Flags)RemainingLength is outside the MQTT variable byte integer range:domain_error(between(0,268435455),RemainingLength)decode_fixed_header/5
Decodes an MQTT fixed header into packet type, flags, remaining length, and remaining bytes.
staticdecode_fixed_header(Bytes,Type,Flags,RemainingLength,Rest)decode_fixed_header(+list(integer),-atom,-integer,-integer,-list(integer)) - one_or_errorBytes starts with an unsupported MQTT packet type:domain_error(mqtt_packet_type,Code)Bytes contains invalid fixed header flags:domain_error(mqtt_fixed_header_flags,Type-Flags)Bytes contains an invalid MQTT variable byte integer:domain_error(mqtt_variable_byte_integer,Consumed)Operators
(none)