image_not_found

Information

Project Brief:

We developed ThingMQ for ThingBrain Barcelona, a startup in the IoT space. ThingMQ is a carrier-grade multi-protocol message broker for the Internet of Things that runs on the cloud. It allows clients to connect their devices to the ThingMQ cloud using MQTT, CoAP, REST or WebSockets and let the plaform handle interoperability. Some of the main features are:

  • Multi-protocol: Publish and consume data using MQTT, CoAP, REST or WebSockets.
  • Bridging: Bridging between multiple protocols, i.e. publish using MQTT and observe using CoAP.
  • Scalable: Runs on an elastic high-availability cluster that scales automatically.
  • Secure: SSL encryption is available for MQTT, WebSockets and REST protocols.

Technical Documentation

To get started using ThingMQ, users connect their devices to mq.thingmq.com using the M2M protocol of their choice. It is important to note that since it is a shared instance, all information your device publishes will be visible to other users. Once the user is connected, they choose a unique identifier for their device, for example my-thing-id. Data can be published under my-thing-id via MQTT, CoAP, REST or WebSockets protocols using JSON, plain-text, XML, BSON, MsgPack or any other payload format. Consuming data published by the user device can be done using any of the supported protocols, all messages are bridged across protocols.

 

REST

The REST API is available at mq.thingmq.com on port 80 while the REST over SSL API listens on port 443. Messages can be published using a POST or PUT request sent to http://mq.thingmq.com/things/my-thing-id. An example using curl follows:

 

$ curl -X PUT -d '{ “temperature”: 22.5, “humidity”: 31 }' \
				  -H "Content-Type: application/json" http://mq.thingmq.com/things/my-thing-id

 

Messages can be consumed by sending a GET request to http://mq.thingmq.com/things/my-thing-id:

 

$ curl http://mq.thingmq.com/things/my-thing-id
				  { “temperature”: 22.5, “humidity”: 31 }

 

 

 

MQTT

The MQTT 3.1.1 compliant broker is available at mq.thingmq.com on the default port 1883 while the MQTT over SSL broker listens on port 8883. Messages can be published under the mqtt://mq.thingmq.com/things/my-thing-id topic. An example using mosquitto_pub follows:

 

$ mosquitto_pub -h mq.thingmq.com -d -t “my-thing-id” -m “{ ‘temperature’: 22.5, ‘humidity’: 31 }"

 

To listen to the messages sent by your device, subscribe to the mqtt://mq.thingmq.com/things/my-thing-id topic:

 

$ mosquitto_sub -h mq.thingmq.com -d -t “my-thing-id”
				  my-thing-id { ‘temperature’: 22.5, ‘humidity’: 31 }

 

Sub-topics are also supported:

 

$ mosquitto_pub -h mq.thingmq.com -d -t “my-thing-id/temperature” -m “22.5”
				  $ mosquitto_pub -h mq.thingmq.com -d -t “my-thing-id/humidity” -m “31”

 

MQTT wildcard operators # and + are fully supported:

 

$ mosquitto_sub -h mq.thingmq.com -d -t “my-thing-id/+”
				  my-thing-id/temperature 22.5
				  my-thing-id/humidity 31

 

 

 

CoAP

The CoAP broker implements the IETF RFC 7252 Constrained Application Protocol standard as well as the observe and blockwise draft specifications. The ThingMQ CoAP server is available at mq.thingmq.com on the default port 5683. Messages can be published under the coap://mq.thingmq.com/things/my-thing-id resource. An example using coap-cli follows:

 

$ echo -n “my-thing-id” -m “{ ‘temperature’: 22.5, ‘humidity’: 31 }" | coap post coap://mq.thingmq.com/things/my-thing-id

 

To consume messages, send a GET request to coap://mq.thingmq.com/things/my-thing-id:

 

$ coap get coap://mq.thingmq.com/things/my-thing-id
				  201 { ‘temperature’: 22.5, ‘humidity’: 31 }

 

And to observe a resource:

 

$ coap -o coap://mq.thingmq.com/things/my-thing-id
				  201 { ‘temperature’: 22.5, ‘humidity’: 31 }

 

 

 

WebSockets

The WebSockets interface is available at mq.thingmq.com on port 80 while the WebSockets over SSL interface listens on port 443. Messages can be published using a POST or PUT request sent to http://mq.thingmq.com/things/my-thing-id. An example using JavaScript and socket.io follows:

 

// Connect to ThingMQ using WebSockets
				  var socket = io.connect("http://mq.thingmq.com");
				  
				  socket.on("connect", function(data) {
					  socket.emit('subscribe', topic);
				  });
				  
				  // Listen on topic "my-thing-id" and write messages to console.
				  socket.on("/things/my-thing-id", function(data) {
					  console.log('Received : ' + data );
				  });