mqtt

Use paho-mqtt with PyQt

强颜欢笑 提交于 2019-12-02 09:01:19
问题 How I can use callback function from QThread? Callback function on_message does not print any data. In run() I connect to mqtt-broker and subscribe on topic. on_message must work when I get new message. Example simple QT app. Change value event connected with simple QLCD. Subscription topic took from dashboard #!/usr/bin/python3 # -*- coding: utf-8 -*- import sys from PyQt5.QtCore import Qt, QThread, pyqtSignal from PyQt5.QtWidgets import (QWidget, QLCDNumber, QSlider, QVBoxLayout,

How can I transmit via MQTT and Receive on AMQP with RabbitMQ and Spring-AMQP

牧云@^-^@ 提交于 2019-12-02 07:41:23
So I've gotten MQTT -> MQTT and AMQP -> AMQP to work; the translation of MQTT -> AMQP doesn't seem to be working somewhere though. Here's my test, it passes if my "listener" is also in MQTT using paho, but this rabbitmq implementation doesn't. @SpringBootTest @SpringJUnitConfig internal open class ProvisioningTest @Autowired constructor( private val mqtt: IMqttAsyncClient, private val mapper: ObjectMapper ) { @Test fun provision() { val entity = Foley( rfid = UUID.randomUUID().toString(), ) val called = AtomicBoolean(false) mqtt.subscribe("foley/created", 1) { _, _ -> called.set(true) } mqtt

RSMB MQTT-SN & Bluetooth

半城伤御伤魂 提交于 2019-12-02 06:29:23
问题 I've been told that MQTT-SN could work with bluetooth instead of TCP/IP. I downloaded RSMB from http://git.eclipse.org/c/mosquitto/org.eclipse.mosquitto.rsmb.git I tried then to configure it to work using anything other than TCP/IP without any luck. In fact the only thing I was able to configure using a configuration file was the port number because I could not find a list of possible configurations anywhere. Does anybody know if it is possible to make such configuration (Bluetooth instead of

App, service and mqtt crashes when wifi disconnects and wont reconnect

我与影子孤独终老i 提交于 2019-12-02 05:48:22
I'm making an app with a mqtt client and a background service that makes a notification when I get certain mqtt message. I use Paho library and service as the client and everything works perfectly as long as I am connected to wifi and the broker is on. I don't want access to the broker over internet so when no wifi is available the client is disconnected, the problem is that when the wifi connects again the mqtt client wont reconnect. I have tried many things but the latest test was to make a handler check if there is internet and if its via wifi, and if it is I start the mqtt server again. I

Use paho-mqtt with PyQt

泪湿孤枕 提交于 2019-12-02 03:56:38
How I can use callback function from QThread? Callback function on_message does not print any data. In run() I connect to mqtt-broker and subscribe on topic. on_message must work when I get new message. Example simple QT app. Change value event connected with simple QLCD. Subscription topic took from dashboard #!/usr/bin/python3 # -*- coding: utf-8 -*- import sys from PyQt5.QtCore import Qt, QThread, pyqtSignal from PyQt5.QtWidgets import (QWidget, QLCDNumber, QSlider, QVBoxLayout, QApplication) from random import uniform, normalvariate, randint import time import paho.mqtt.client as mqtt

Example MQTT Client Code not working C

元气小坏坏 提交于 2019-12-02 03:54:14
I got the example code from here . I have the header file MQTTClient.h as well. However when I build I get the errors: undefined reference to MQTTClient_create undefined reference to MQTTClient_connect undefined reference to MQTTClient_publishMessage undefined reference to MQTTClient_waitForCompletion undefined reference to MQTTClient_disconnect In the header file these are set up as follows: DLLExport int MQTTClient_create(MQTTClient* handle, const char* serverURI, const char* clientId, int persistence_type, void* persistence_context); I am using a Windows 8 machine with Eclipse C/C++ IDE I

搭建IM服务 so easy

谁说我不能喝 提交于 2019-12-02 00:40:47
现在很多网站、APP都通过IM服务来实现消息推送及数据即时同步功能,即时通讯组件逐渐成为产品的标配。目前国内有很多成熟稳定的第三方即时通讯服务厂家,比如: 融云 。使用这些专业的服务可以提高开发效率而且服务稳定有保障。 如果自己DIY或者需要在封闭的局域网内使用IM服务,该怎么办呢?下文就简单介绍一下 EasyPM 曾经实践过的自行搭建IM服务过程。 数据同步方式 实现数据同步,有"推"、"拉" 两种思路,具体有以下几种方式: 使用HTTP轮循方式 说明:定时向HTTP服务端接口(Web Service API)获取最新消息,可结合ajax技术实现页面无刷新效果,这是主动拉取消息的机制。 优点:实现简单、可控性强、部署成本低 缺点:实时性差,增加服务端负载 使用XMPP协议 说明:XMPP是基于可扩展标记语言(XML)的协议,它用于即时消息(IM)以及在线现场探测。它促进在服务器之间的准即时操作,其前身是Jabber,是一个开源形式组织产生的网络即时通信协议。XMPP目前被IETF国际标准组织完成了标准化工作。 优点:协议成熟、强大、可扩展性强、目前主要应用于众多IM系统 缺点:协议比较复杂、冗余(基于XML)、费流量 使用MQTT协议 说明:MQTT(Message Queuing Telemetry Transport,消息队列遥测传输)是IBM开发的一个即时通讯协议

How to compile using libmosquitto

混江龙づ霸主 提交于 2019-12-01 23:02:31
问题 Iam trying to compile the code example available on the libmosquitto website (at the bottom): http://mosquitto.org/man/libmosquitto-3.html Iam using Ubuntu 12.04 and I've installed libmosquitto1 and libmosquitto1-dev packages. Before installing them I added the mosquitto repository: sudo apt-add-repository ppa:mosquitto-dev/mosquitto-ppa sudo apt-get update Iam trying to compile the example as follows: gcc -lmosquitto mosquito.c -o mosquito But I get the following errors: /tmp/cc6eU8kw.o: In

Mqtt : Publish the last line from a file that is periodically updated

蓝咒 提交于 2019-12-01 22:42:11
问题 I have an arduino board that sends periodically the temperature to a txt file. The file is updating every minute(the new data is overwritten not appended). I want to make a mqtt client that reads the file periodically and publishes the last received data. My client publishes no text. Is there a way I can do that ? Here what I have until now: import mosquitto import time client=mosquitto.Mosquitto("read-file") client.connect("broker.mqttdashboard.com", 1883) f=open("/home/ioana/date_sensor",

Why MQTT is called as “light weight” messaging protocol?

旧时模样 提交于 2019-12-01 18:23:48
问题 As per Wikipedia and Mqtt.org, MQTT is a machine-to-machine (M2M)/"Internet of Things" connectivity protocol. It was designed as an extremely lightweight publish/subscribe messaging transport. In comparison with other TCP/IP or socket based protocols, what makes MQTT "extremely light-weighted"? 回答1: The protocol overhead of MQTT is extremely small, the smallest packet has only 2 bytes overhead. The payload-to-overhead ratio is typically extremely good. It's also a binary protocol which