hcoap-0.1.2.1: CoAP implementation for Haskell.

Maintainerulf.lilleengen@gmail.com
Safe HaskellNone
LanguageHaskell2010

Network.CoAP.Message

Description

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.

Synopsis

Documentation

data Message Source

CoAP message record. Can be encoded and decoded to ByteString.

Instances

type MessageVersion = Int Source

CoAP version. Only a value of 1 is valid.

data MessageType Source

Valid CoAP message types.

Constructors

CON 
NON 
ACK 
RST 

type MessageId = Word16 Source

CoAP message id. This is unique for each message from a given endpoint.

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

data MediaType Source

Supported media types in CoAP RFC for ContentFormat

Instances

data Method Source

Request Method

Constructors

GET 
POST 
PUT 
DELETE 

encode :: Message -> ByteString Source

Encode a CoAP message according to the specification.

decode :: ByteString -> Either String Message Source

Decode a CoAP message according to the specification.