paho

Paho MqttAndroidClient.connect always fails

痞子三分冷 提交于 2019-12-31 10:48:13
问题 I'd like to publish messages from an android service to a local server. Here is parts of my code in the simplest form based on snippets from here. MemoryPersistence memPer; MqttAndroidClient client; @Override public IBinder onBind(Intent intent) { memPer = new MemoryPersistence(); client = new MqttAndroidClient(this, "tcp://192.168.1.42:1883", "clientid", memPer); try { client.connect(null, new IMqttActionListener() { @Override public void onSuccess(IMqttToken mqttToken) { Log.i("MQTT",

Paho MqttAndroidClient.connect always fails

偶尔善良 提交于 2019-12-31 10:46:50
问题 I'd like to publish messages from an android service to a local server. Here is parts of my code in the simplest form based on snippets from here. MemoryPersistence memPer; MqttAndroidClient client; @Override public IBinder onBind(Intent intent) { memPer = new MemoryPersistence(); client = new MqttAndroidClient(this, "tcp://192.168.1.42:1883", "clientid", memPer); try { client.connect(null, new IMqttActionListener() { @Override public void onSuccess(IMqttToken mqttToken) { Log.i("MQTT",

How do I create a actor if I subscribe to a specific topic?

雨燕双飞 提交于 2019-12-30 13:34:23
问题 Hi I have some code which includes publish/subscribe and actors. The generic_device class allows me to create other actors. I was wondering how do I create a specific actor from the generic_device class when I subscribe to a topic and if the topic isn't subscribed then no actor is created from the generic_device class. At the moment it is just if a specific message is received then the actor is created. All help appreciated thanks. import logging from datetime import timedelta import time

Send many publish message: Too many publishes in progress Error

丶灬走出姿态 提交于 2019-12-30 11:24:48
问题 Here is paho Async client: client = new MqttAsyncClient(appProps.getProperty("mqtt.broker"), appProps.getProperty("mqtt.clientId"), new MemoryPersistence()); client.setCallback(this); client.connect(null, new IMqttActionListener() { @Override public void onSuccess(IMqttToken imt) { try { client.subscribe(Constants.internalTopics, Constants.internalTopicQOS); } catch (MqttException ex) { ex.printStackTrace(); } } @Override public void onFailure(IMqttToken imt, Throwable thrwbl) { thrwbl

Spring Integration MQTT Subscriber (paho) stops processing messages

主宰稳场 提交于 2019-12-29 09:49:07
问题 We're experiencing an issue with one of our MQTT subscribers in Spring integration (4.0.3.RELEASE running on Tomcat 7 with the Paho MQTT Client 0.4.0). The issue is with a subscriber on a heavily used topic (lots of messages). The devices sending the messages to the topic are devices in the field connecting over GPRS. Spring integration and the broker (Mosquitto) are running on the same server. The issue seems to appear after doing a couple of redeploys on the Tomcat without restarting the

How to read data from MQTT in Eclipse Paho?

℡╲_俬逩灬. 提交于 2019-12-25 06:45:20
问题 I am trying to read sensor data using MQTT, using Eclipse Paho. I am successfully connected, but I want to read data. my code so far: public static void main(String[] args) { MqttClient client; MqttMessage msg; MemoryPersistence persistence; MqttConnectOptions conn; IMqttMessageListener listen; String broker = "tcp://url:1883"; String str = "password"; char[] accessKey = str.toCharArray(); String appEUI = "userID"; try { persistence = new MemoryPersistence(); client = new MqttClient(broker,

How to use MQTT on React Native?

北慕城南 提交于 2019-12-24 10:25:23
问题 I am pretty new at React Native, and I would like to use MQTT in my app. I trying to follow the instructions in the link --> https://github.com/Introvertuous/react_native_mqtt I installed MQTT throught the command --> npm install react_native_mqtt --save My question is: - Where should I paste the code below? In the app.js file? Do I need to create another file? - What should I write in the app.js file to test the MQTT connection? Any guidance it is welcome. import init from 'react_native_mqtt

Paho MQTT Python Client: No exceptions thrown, just stops

半世苍凉 提交于 2019-12-23 09:50:27
问题 I try to setup a mqtt client in python3. This is not the first time im doing this, however i came across a rather odd behaviour. When trying to call a function, which contains a bug, from one of the callback functions (on_connect or on_message), python does not throw an exception (at least it is not printed), it just stops there. I tied together a short example, that reproduces that behaviour. Does someone has an idea? import paho.mqtt.client as mqtt import re import os.path import json from

Content-Type alternative in MQTT

痴心易碎 提交于 2019-12-23 01:28:40
问题 I am Working on MQTT communication using Paho and Mosqitto. We have to support both model of serialization - xml and json. So I am looking How to identify the content type or payload type in MQTT. Is there something similar HTTP Content-Type in MQTT to identify it quickly ? Content-Type : application/json Content-Type : application/xml Thanks 回答1: No, MQTT payloads are just byte arrays and there is no space in the headers (because MQTT is designed to be as light weight as possible on the

Cannot receive already published messages to subscribed topic on mqtt paho

為{幸葍}努か 提交于 2019-12-22 08:21:45
问题 I'm using paho to send and receive mqtt messages. So far it has been no problem to send the messages. I have problems with receiving them.My code is: package BenchMQTT; import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken; import org.eclipse.paho.client.mqttv3.IMqttToken; import org.eclipse.paho.client.mqttv3.MqttCallback; import org.eclipse.paho.client.mqttv3.MqttException; import org.eclipse.paho.client.mqttv3.MqttMessage; import org.eclipse.paho.client.mqttv3.MqttClient; public class