Commit de198fc6 authored by Riccardo Presotto's avatar Riccardo Presotto

set mqtt sub sync

parent 97fdc3a7
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
REST_MQTT_example
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings"> <component name="GradleSettings">
<option name="linkedExternalProjectsSettings"> <option name="linkedExternalProjectsSettings">
<GradleProjectSettings> <GradleProjectSettings>
......
No preview for this file type
File added
File deleted
REST/beans/Users.java
REST.beans.Users
REST/StartServer.java
REST.StartServer
REST/beans/User.java REST/beans/User.java
REST.beans.User REST.beans.User
REST/services/HelloWorld.java REST/services/HelloWorld.java
REST.services.HelloWorld REST.services.HelloWorld
REST/services/UsersService.java REST/services/UsersService.java
REST.services.UsersService REST.services.UsersService
REST/StartServer.java
REST.StartServer
REST/beans/Users.java
REST.beans.Users
MQTT/PubExample.java MQTT/PubExample.java
PubExample MQTT.PubExample
MQTT/SubExample.java MQTT/SubExample.java
SubExample MQTT.SubExample
SubExample$1 MQTT.SubExample$1
...@@ -18,14 +18,13 @@ public class SubExample { ...@@ -18,14 +18,13 @@ public class SubExample {
try { try {
// Create an Mqtt client // Create an Mqtt client
MqttAsyncClient mqttClient = new MqttAsyncClient(broker, clientId); MqttClient mqttClient = new MqttClient(broker, clientId);
MqttConnectOptions connOpts = new MqttConnectOptions(); MqttConnectOptions connOpts = new MqttConnectOptions();
connOpts.setCleanSession(true); connOpts.setCleanSession(true);
// Connect the client // Connect the client
System.out.println(clientId + " Connecting to " + broker); System.out.println(clientId + " Connecting to " + broker);
IMqttToken token = mqttClient.connect(connOpts); mqttClient.connect(connOpts);
token.waitForCompletion();
System.out.println(clientId + " Connected"); System.out.println(clientId + " Connected");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment