coap

package
v0.5.2-rc2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2018 License: BSD-3-Clause Imports: 12 Imported by: 0

README

tibco-coap

This trigger provides your flogo application the ability to start a flow via CoAP

Installation

flogo add trigger github.com/TIBCOSoftware/flogo-contrib/trigger/coap

Schema

Settings, Outputs and Endpoint:

"settings": [
  {
    "name": "port",
    "type": "integer",
  }
],
"output": [
  {
    "name": "payload",
    "type": "string"
  }
],
"endpoint": {
  "settings": [
    {
      "name": "method",
      "type": "string",
      "required" : true
    },
    {
      "name": "path",
      "type": "string",
      "required" : true
    }
  ]
}

Settings

Trigger:
Setting Description
port Used to override the standard CoAP server port of 5683
Endpoint:
Setting Description
method The CoAP method
path The resource path

Example Configurations

Triggers are configured via the triggers.json of your application. The following are some example configuration of the CoAP Trigger.

POST

Configure the Trigger to handle a CoAP POST message with path /device/refresh

{
  "triggers": [
    {
      "name": "tibco-coap",
      "settings": {},
      "endpoints": [
        {
          "actionType": "flow",
          "actionURI": "embedded://myflow",
          "settings": {
            "method": "POST",
            "path": "/device/refresh"
          }
        }
      ]
    }
  ]
}

Testing

Do to some simple testing of the CoAP trigger, you can use the Copper (Cu) plugin for Firefox.

Once you have the plugin installed, you can interact with the trigger by going to: coap://localhost:5683 in Firefox.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFactory

func NewFactory(md *trigger.Metadata) trigger.Factory

NewFactory create a new Trigger factory

Types

type CoapFactory

type CoapFactory struct {
	// contains filtered or unexported fields
}

CoapFactory Coap Trigger factory

func (*CoapFactory) New

func (f *CoapFactory) New(config *trigger.Config) trigger.Trigger

New Creates a new trigger instance for a given id

type CoapResource

type CoapResource struct {
	// contains filtered or unexported fields
}

type CoapTrigger

type CoapTrigger struct {
	// contains filtered or unexported fields
}

CoapTrigger CoAP trigger struct

func (*CoapTrigger) Init

func (t *CoapTrigger) Init(runner action.Runner)

func (*CoapTrigger) Metadata

func (t *CoapTrigger) Metadata() *trigger.Metadata

Metadata implements trigger.Trigger.Metadata

func (*CoapTrigger) Start

func (t *CoapTrigger) Start() error

Start implements trigger.Trigger.Start

func (*CoapTrigger) Stop

func (t *CoapTrigger) Stop() error

Stop implements trigger.Trigger.Start

type IDResponse

type IDResponse struct {
	ID string `json:"id"`
}

IDResponse id response object

type Server

type Server struct {
	Handler coap.Handler
	Addr    string
	// contains filtered or unexported fields
}

Server the server structure

func NewServer

func NewServer(n, addr string, handler coap.Handler) *Server

NewServer create a new server instance

func (*Server) IsStarted

func (s *Server) IsStarted() bool

IsStarted checks if the server is started will return true even if the server is stopped but there are still some requests to finish

func (*Server) Start

func (s *Server) Start() error

Start will start server command isn't blocking, will exit after run

func (*Server) Stop

func (s *Server) Stop() error

Stop sends stop command to the server

func (*Server) WaitStop

func (s *Server) WaitStop(timeout time.Duration) error

WaitStop waits until server is stopped and all requests are finish timeout - is the time to wait for the requests to finish after the server is stopped will return error if there are still some requests not finished

type StartFunc

type StartFunc func(payload string) (string, bool)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL