mqtt-hs-1.0.1: A MQTT client library.

Maintainerkoomi+mqtt@hackerspace-bamberg.de
Safe HaskellNone

Network.MQTT.Encoding

Contents

Description

Binary encoding for MQTT messages.

Synopsis

Documentation

writeTo :: Handle -> Message t -> IO ()Source

Directly write a Message to the buffer of a Handle.

putMessage :: Message t -> BuilderSource

Generate a Builder for any Message.

Fixed Header

putMqttHeader :: MqttHeader -> Word8 -> BuilderSource

Build a MqttHeader for the given message type.

encodeRemaining :: Int64 -> BuilderSource

Encode the remaining length field.

Body

putBody :: MessageBody t -> BuilderSource

Build the MessageBody for any message type.

Utility functions

putMsgID :: MsgID -> BuilderSource

Build a MsgID.

putMqttText :: MqttText -> BuilderSource

Build a length-prefixed MqttText.

putTopic :: Topic -> BuilderSource

Build a Topic.

fromQoS :: Num a => QoS -> aSource

Encode a QoS.

toBit :: Num a => Bool -> aSource

Convert a Bool to 0 or 1.

msgType :: Num a => MessageBody t -> aSource

Encode the type of a MessageBody.