mqtt-hs-0.2.0: A MQTT client library.

CopyrightLukas Braun 2014
LicenseGPL-3
Maintainerkoomi+mqtt@hackerspace-bamberg.de
Safe HaskellNone
LanguageHaskell2010

MQTT.Encoding

Contents

Description

Binary encoding for MQTT messages.

Synopsis

Documentation

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

Directly write a Message to the buffer of a Handle.

putMessage :: Message t -> Builder

Generate a Builder for any Message.

Fixed Header

putMqttHeader :: MqttHeader -> Word8 -> Builder

Build a MqttHeader for the given message type.

encodeRemaining :: Int64 -> Builder

Encode the remaining length field.

Body

putBody :: MessageBody t -> Builder

Build the MessageBody for any message type.

Utility functions

putMsgID :: MsgID -> Builder

Build a MsgID.

putMqttText :: MqttText -> Builder

Build a length-prefixed MqttText.

putTopic :: Topic -> Builder

Build a Topic.

fromQoS :: Num a => QoS -> a

Encode a QoS.

toBit :: Num a => Bool -> a

Convert a Bool to 0 or 1.

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

Encode the type of a MessageBody.