Mainflux.mainflux/coap
Dejan Mijić bca3d0774f
MF-201 - Replace ORM with SQL (#265)
2018-05-11 01:00:10 +02:00
..
api MF-201 - Replace ORM with SQL (#265) 2018-05-11 01:00:10 +02:00
nats MF-168 - Refactor CoAP adapter (#186) 2018-05-08 16:00:25 +02:00
README.md MF-168 - Refactor CoAP adapter (#186) 2018-05-08 16:00:25 +02:00
adapter.go MF-201 - Replace ORM with SQL (#265) 2018-05-11 01:00:10 +02:00

README.md

Mainflux CoAP Adapter

Mainflux CoAP adapter provides an CoAP API for sending messages through the platform.

Configuration

The service is configured using the environment variables presented in the following table. Note that any unset variables will be replaced with their default values.

Variable Description Default
MF_COAP_ADAPTER_PORT adapter listening port 5683
MF_NATS_URL NATS instance URL nats://localhost:4222
MF_MANAGER_URL manager service URL http://localhost:8180

Deployment

The service is distributed as Docker container. The following snippet provides a compose file template that can be used to deploy the service container locally:

version: "2"
services:
  adapter:
    image: mainflux/coap-adapter:[version]
    container_name: [instance name]
    ports:
      - [host machine port]:[configured port]
    environment:
      MF_MANAGER_URL: [Manager service URL]
      MF_NATS_URL: [NATS instance URL]
      MF_COAP_ADAPTER_PORT: [Service HTTP port]

Running this service outside of container requires working instance of the NATS service. To start the service outside of the container, execute the following shell script:

# download the latest version of the service
go get github.com/mainflux/mainflux

cd $GOPATH/src/github.com/mainflux/mainflux

# compile the http
make coap

# copy binary to bin
make install

# set the environment variables and run the service
MF_MANAGER_URL=[Manager service URL] MF_NATS_URL=[NATS instance URL] MF_COAP_ADAPTER_PORT=[Service HTTP port] $GOBIN/mainflux-coap

Usage

Since CoAP protocol does not support Authorization header (option), in order to send CoAP messages, client valid key must be present in Uri-Query option.