Open IOT Challenge: work in progress and CoAP Gateway
I participate in the Open IOT Challenge (see post http://k33g.github.io/2015/12/10/IOT-CHALLENGE-01.html), my project is called âAttaâ, in the previous post, I was taking about of the implementation of MQTT Gateway simulator (http://k33g.github.io/2015/12/15/IOT-CHALLENGE-02.html) and today I completed a 1st simple version of the CoaP Gateway.
What is CoAP?
CoAP (Constrained Application Protocol) is used as IOT protocol, itâs a restful protocol and itâs used with simple devices. in fact with CoAP, there is no central server. âServersâ of resources are listening on each devices or gateway. To my mind itâs a good solution for problems of âhigh availabilityâ and âfault toleranceâ: you can easily add or replace a Gateway, and itâs more difficult to replace a server ;).
So, CoAP is a RESTful protocol, used in/with very simple electronics devices (LoWPAN). And a CoAP client makes query to a âserverâ of âresourcesâ like that:
GET /status/led/red
POST /control/switchon/red
That is why, I also wanted to include a CoAP simulator in Atta (you know, my little DSL https://github.com/ant-colony/atta).
The CoAP Gateway
Itâs a first version, and itâs a simple version (SimpleCoapGateway
class) (one gateway - one resource and one REST method: GET
), in the future, Iâll provide a CoapGateway
with the ability to get several resources and all REST methods.
Itâs also easy to create a CoAP gateway instance than creating a MQTT gateway instance (see previous post):
Remark: Iâve used the Californium project https://www.eclipse.org/californium/ to create my gateways.
Use a NodeJS CoAP client to query the gateway
Itâs very easy to create a JavaScript CoAP client with the node-coap project https://github.com/mcollina/node-coap
Use a Golo CoAP client to query the gateway
Golo http://golo-lang.org/ plays very well with Californium:
Once again, you can see that itâs very easy to simulate âconnected thingsâ with Atta. Next time, weâll see the REST Gateway and/or some more sophisticated sensors simulators.
Atta project is here: https://github.com/ant-colony/atta yes, I know, it lacks a little bit of documentation.
Stay tuned :)
Tweet