hcoap-0.1.2.1: CoAP implementation for Haskell.

Maintainerulf.lilleengen@gmail.com
Safe HaskellNone
LanguageHaskell2010

Network.CoAP.Client

Description

License: BSD3

The CoAP client API is intended to provide the minimal building block needed for sending CoAP requests. The API exposes CoAP request and response types and handles all internal messaging details of the CoAP protocol.

Example:

    client <- createClient (createUDPTransport socket)
    doRawRequest client (SockAddrInet 5683 0) (Request GET [UriPath path] Nothing True)

Synopsis

Documentation

data Client Source

A client that can perform CoAP requests.

Constructors

Client 

Fields

doRequest :: URI -> Request -> IO Response

Send a CoAP request to a given endpoint represented by an URI. Returns a CoAP response.

doRawRequest :: Endpoint -> Request -> IO Response

Send a CoAP request to a given endpoint. Returns a CoAP response.

shutdownClient :: IO ()

Stop a client. Ensures that no threads are running and that messaging layer is shut down.

data Method Source

Request Method

Constructors

GET 
POST 
PUT 
DELETE 

type OptionString = ByteString Source

CoAP Option ByteString

data MediaType Source

Supported media types in CoAP RFC for ContentFormat

Instances

createClient :: Transport -> IO Client Source

Create a client using a given transport. This will spawn internal messaging threads making the client ready to send requests.