Maintainer | ulf.lilleengen@gmail.com |
---|---|
Safe Haskell | None |
Language | Haskell2010 |
License: BSD3
The CoAP message API is intended to provide the minimal building block needed for creating, encoding and decoding CoAP messages. The module can be used to build alternative CoAP messaging layers.
- data Message = Message {
- messageVersion :: !MessageVersion
- messageType :: !MessageType
- messageCode :: !MessageCode
- messageId :: !MessageId
- messageToken :: !Token
- messageOptions :: ![Option]
- messagePayload :: !(Maybe Payload)
- type MessageVersion = Int
- data MessageType
- type MessageId = Word16
- data MessageCode
- type Token = ByteString
- type Payload = ByteString
- data Option
- data MediaType
- data Method
- encode :: Message -> ByteString
- decode :: ByteString -> Either String Message
Documentation
CoAP message record. Can be encoded and decoded to ByteString.
Message | |
|
type MessageVersion = Int Source
CoAP version. Only a value of 1 is valid.
data MessageType Source
Valid CoAP message types.
type MessageId = Word16 Source
CoAP message id. This is unique for each message from a given endpoint.
data MessageCode Source
Valid CoAP message codes.
type Token = ByteString Source
CoAP request token. This is unique for a request from a given endpoint.
type Payload = ByteString Source
Request/response payload ByteString
CoAP Option types.
Supported media types in CoAP RFC for ContentFormat
Request Method
encode :: Message -> ByteString Source
Encode a CoAP message according to the specification.