More Related Content Similar to MQTT with Eclipse Paho: A protocol for IoT and M2M communication (20) MQTT with Eclipse Paho: A protocol for IoT and M2M communication1. MQTT with Eclipse Paho
A protocol for IoT and M2M communication
Christian Götz, dc-square
Day Florence 2014
2. Hi, I’m Christian Götz
author & speaker
building solutions
CEO &
co-founder
developer
@goetzchr
4. Open Hardware is everywhere
Raspberry Pi is a trademark of the
Raspberry Pi Foundation
5. 6,5 per person
DEVICES outnumber
people
0
12,5
25,0
37,5
50,0
2003 2010 2015 2020
50,0
25,0
12,5
0,5
6,0
6,5
7,0
7,5
8,0
2003 2010 2015 2020
7,6
7,3
6,8
6,3
250 new every sec
http://blogs.cisco.com/news/cisco-connections-counter/
http://www.cisco.com/web/about/ac79/docs/innov/IoT_IBSG_0411FINAL.pdf
2020
in billions
22. Based on top of TCP
Simple
Publish/Subscribe
Architecture
BinaryMinimal Overhead
Designed for unreliable
networks
Data agnostic
MQTT facts
23. 1999 2010 2013 2014
Arlen Nipper &
Andy Stanford-Clark
invent MQTT
royalty free OASIS TC
formed
MQTT becomes
Standard
MQTT history
24. Push instead of Poll
Minimal Bandwidth is important Mobile meets Enterprise
Unreliable networks Constrained devices
Low Latency
MQTT use cases
28. MQTT real world usage
https://www.facebook.com/notes/facebook-
engineering/building-facebook-messenger/
10150259350998920
31. MQTT Broker HiveMQ
High performance broker
Open Plugin System Clustering
Bridging Scalable to > 100.000
connections
Native Websocket support
37. MqttClient client = new MqttClient(
"tcp://localhost:1883", //URI
"publisher", //Client ID
new MemoryPersistence()); //Persistence
client.connect();
client.publish("my/topic/123",//topic
"Hello!".getBytes(), //message
1, //QoS
false); //retained
client.disconnect();
38. MqttClient client = new MqttClient(...);
MqttConnectOptions connOptions = new
MqttConnectOptions();
connOptions.setKeepAliveInterval(120);
connOptions.setWill("my/status",
"offline".getBytes(), 2, true);
connOptions.setCleanSession(false);
connOptions.setUserName("user");
connOptions.setPassword("pass".toCharArray(
));
client.connect(connOptions);
39. MqttAsyncClient client = new MqttAsyncClient(...);
client.connect(null, new IMqttActionListener() {
@Override
public void onSuccess(IMqttToken asyncActionToken)
{
try {
client.publish(...);
} catch (MqttException e) {}
}
@Override
public void onFailure(IMqttToken asyncActionToken,
Throwable exception) {}
});
client.disconnect();
40. final MqttClient client = new MqttClient(...);
client.setCallback(new MqttCallback() {
@Override
public void connectionLost(Throwable cause) {}
@Override
public void messageArrived(String topic,
MqttMessage message)throws Exception
{
System.out.println(new String(message.getPayload()));
}
@Override
public void deliveryComplete(IMqttDeliveryToken
token) {}
});
client.connect();
client.subscribe("#");
42. Demo from device to the web with MQTT
https://github.com/dc-square/mqtt-with-paho-eclipsecon2013
available on
44. Content Credits
• title image “florence sunset” taken by Justin Mier
https://flic.kr/p/ehwDwz
• All other photos are from www.depositphotos.com