Ponte, a M2M bridge for MQTT, CoAP and HTTP

In an earlier post I described how I setup Mosquitto as a local MQTT broker. In this post I will introduce you to “Ponte” a brilliant project that’s in development at the Eclipse foundation.

What is Ponte

Ponte Architecture
Ponte Architecture – Image Source: Ponte team.

Ponte is a M2M bridge framework that aims to close the gap between M2M interactions and the rest of the Internet. The current implementation is built on top of NodeJs.

Protocols like MQTT and CoAP are playing a major role in standardizing M2M communications. These protocols have been making it easier for building connected devices. For the vision of Internet of Things to be fully realized, these devices need to be accessible to the world wide web in a language that WWW speaks. WWW and Internet don’t speak MQTT or CoAP naturally. They speak HTTP.  For example you cannot easily have your PC or a MAC or smart phone access the information from the MQTT/CoAP bridges without resorting to custom applications that use specific libraries (like the Paho MQTT client Libraries.)

That’s where a bridge like Ponte becomes extremely useful. It can speak MQTT, CoAP and HTTP.. That makes it imminently suitable for connecting the resource constrained devices with the rest of the world. Also it supports excellent array of storage engines that allow data from the connected things to be stored, analyzed, syndicated and do whatever we do with regular databases.

For example consider the Sudden Impact design challenge currently running on Element 14. Multiple sensors and devices would be sending data to the Ponte bridge using MQTT or CoAP. A Ponte Bridge will allow that data to be collated in one place and analyzed. Web/mobile applications can be easily written using the HTTP bridge on Ponte to present it to users.

For the Holiday lights IoT challenge I will present a small use case later that will demonstrate the power of Ponte over other MQTT bridges.
Update: Please see the following posts for use cases.
Part 3.2: Reading a MQTT topic with HttpClient On Arduino Yun
Part 3.3: Arduino Uno + ESP8266 + Eclipse Ponte HTTP Bridge = MQTT Magic

Installing Ponte

    1. If you do not have nodejs already installed, install it from
    2. Do a npm update to make sure that node package manager is up to date
    3. Install Ponte by running the following:
npm install ponte -g $ ponte

Running Ponte:

1. If you are already running a MQTT broker like mosquitto, stop it. (In windows use the windows services control panel.)
2. then run Ponte from command line (with a verbose flag if you want to see more information as each connection is made):

ponte -v 

Here is an output from my PC when I run Ponte in verbose mode:

C:\RnD\nodejs\node_modules>ponte -v
,"mqtt":1883,"msg":"server started","time":"2014-12-26T18:25:43.234Z","v":0}
,"port":6000,"msg":"server started","time":"2014-12-26T18:25:43.253Z","v":0}
,"port":6683,"msg":"server started","time":"2014-12-26T18:25:43.254Z","v":0}

Note the ports at which each of the HTTP, MQTT and CoAP srvers are running. On my machine I edited the HTTP port number and the CoAP port numbers in the Server.js file (found at C:\Users\XXX_User_name\AppData\Roaming\npm\node_modules\ponte\lib)

Note down the port number for HTTP.. It should be 3000 by default.

Accessing MQTT Topics from HTTP

Each MQTT Topic can be accessed from the Ponte HTTP Endpoint by adding the topic name after resources. For example: Considering that your “MyHostName” is your host name and the http port for Ponte is 3000, the http URL for the topic “MyFirstTopic” is:


Now to subscribe to messages from this topic we use “GET” and to publish messages to this topic we use “PUT”

Publishing from HTTP to MQTT

Go to Terminal or command prompt and use curl (On windows i installed curl from Also if you have already installed mosquitto broker as described here, it would have come with two very handy utilities for publishing and subscribing (mosquitto_pub and mosquitto_sub). I will be using them as here.

First run mosquitto_sub to listen to messages on all the topics. (This is just for testing and verifying. Typically you will be listening to specific topics in actual client implementations).

mosquitto_sub -v -h localhost -t "#"

Then open another terminal and run curl to “PUT” mqtt message “255,255,0” to topic name “RGB”

curl -X PUT -d "255,255,0" http://localhost:3000/resources/RGB

Now you should see the message popping up on the mosquitto_sub window.

Publishing from MQTT to HTTP

Use mosquitto_pub to send a test message. Make sure the retain flag ( -r ) is set to ensure the broker retains the message until some client reads the message.

mosquitto_pub -r -h localhost -t FromPC/TestPonte -m "Are you There?"

use Curl to issue a GET to read the message

curl http://localhost:3000/resources/FromPC/TestPonte

Now you should see the message in the curl response.


Following links provide more information on Ponte:
Ponte – Bringing Things to REST developers

Stay tuned for more articles on how I use Ponte bridge in my IoT Holiday lights project.

Update: see here for additional blog entries:
Part 3.2: Reading a MQTT topic with HttpClient On Arduino Yun
Part 3.3: Arduino Uno + ESP8266 + Eclipse Ponte HTTP Bridge = MQTT Magic

4 replies on “Ponte, a M2M bridge for MQTT, CoAP and HTTP”

Hey I’m having some issues with this, and I hope you can help.

I’ve completed all steps, but I’m not able to read MQTT messages via HTTP for all of the MQTT messages that come from my environment. I can see them when I sub to the broker, but when i try to hit the endpoint, I get not found…

From the sub I seee:

miflora/$announce {“jasmine”: {“refresh”: 90, “mac”: “C4:7C:8D:66:57:6C”, “name_pretty”: “jasmine”, “firmware”: “3.1.8”, “topic”: “miflora/jasmine”, “location_clean”: “”, “location_pretty”: “”}, “boug”: {“refresh”: 90, “mac”: “C4:7C:8D:66:30:5F”, “name_pretty”: “boug”, “firmware”: “3.1.8”, “topic”: “miflora/boug”, “location_clean”: “”, “location_pretty”: “”}, “orange”: {“refresh”: 90, “mac”: “C4:7C:8D:66:31:F5”, “name_pretty”: “orange”, “firmware”: “3.1.8”, “topic”: “miflora/orange”, “location_clean”: “”, “location_pretty”: “”}}
miflora/jasmine {“moisture”: 34, “conductivity”: 254, “battery”: 99, “temperature”: 17.8, “light”: 39}
miflora/boug {“moisture”: 26, “conductivity”: 373, “battery”: 99, “temperature”: 18.2, “light”: 37}
miflora/orange {“moisture”: 16, “conductivity”: 93, “battery”: 99, “temperature”: 17.9, “light”: 21}
RGB 255,255,255

Yet I’m not able to hit /resources/miflora/orange or any of the json ones, but if I get /resources/RGB, it returns a value.

Leave a Reply

Your email address will not be published. Required fields are marked *