mqtt

Writing an brokerless AMQP to MQTT adaptor

我的梦境 提交于 2021-02-11 18:22:53
问题 I want to implement an amqp to mqtt adapter, which would receive amqp messages, take their payload and publish it as mqtt messages to my mqtt broker. Therefore the adapter must be able to listen on a port confirm connect requests receive amqp messages acknowledge them publish with mqtt In my ecosystem I want to provide different protocols for incoming messages, but I want to run only one mqtt broker. I want to avoid any other broker. I read here that amqp "1.0 permits brokerless point-to

Arduino使用ESP8266模块联网

自作多情 提交于 2021-02-11 15:27:46
ESP8266模块准备 1. 透传程序烧写 2. Arduino与ESP8266接线 Arduino模块程序 测试 总结 上一篇文章已经介绍了 利用 ArduinoIDE开发ESP8266模块,这篇文章介绍一下arduino怎么通过ESP8266模块联网 ESP8266模块准备 1. 透传程序烧写 以下程序的主要功能是: 1. 通电自动连接指定wifi 2. 通过tcp协议连接指定服务器的指定端口 3. tcp连接断线重连 4. 10s自动发送心跳包 #include <ESP8266WiFi.h> const char *ssid = "你的wifi" ; const char *password = "wifi密码" ; WiFiClient client ; const char *host = "服务器" ; const int port = 0 ; void setupWifi() { delay( 10 ); Serial.println(); Serial.print( "Connecting to " ); Serial.println(ssid); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay( 500 ); Serial.print( "." ); }

using mqtt-ngx to connet in tls via websocket to a broker

倖福魔咒の 提交于 2021-02-11 13:51:40
问题 I have a remote mosquitto broker (on a aws ec2 instance with windows) and everything is working fine: the ports are accessible and i can publish and subscribe with the rules of my acl. I've limited the publish operation to my .net core server (with identityserver 4), while my angular8 app with ngx-mqtt subscribes. Now i'm trying to enable tls, but it keep failing on connecting. main-es2015.42b21e2ecd07be623604.js:1 WebSocket connection to 'wss://myserver/mqtt' failed: Error in connection

How to catch “access error” when publish inaccessible topic in mqtt.js?

可紊 提交于 2021-02-11 13:13:51
问题 I am creating a project using node.js with mqtt.js and mosquitto broker. In mosquitto config file, I have setup a pwfile, aclfile to control which topic can be accessed by which user. Everything works fine, if the username, password, publish topic and subscribe topic are correct. But if I change the publish topic to an inaccessible topic, it seems successfully publish the topic without any error in mqtt.js, but the message is never been publish. Is there anyway to catch error when publish or

How to catch “access error” when publish inaccessible topic in mqtt.js?

爷,独闯天下 提交于 2021-02-11 13:07:54
问题 I am creating a project using node.js with mqtt.js and mosquitto broker. In mosquitto config file, I have setup a pwfile, aclfile to control which topic can be accessed by which user. Everything works fine, if the username, password, publish topic and subscribe topic are correct. But if I change the publish topic to an inaccessible topic, it seems successfully publish the topic without any error in mqtt.js, but the message is never been publish. Is there anyway to catch error when publish or

MQTT Broker mosquitto

眉间皱痕 提交于 2021-02-10 18:35:09
MQTT 全称 MQ Telemetry Transport 消息队列遥测传输协议 IBM 1994开发 MQTT v3.1.1 第4版 OASIS标准 1 to 0/1/N 简介 MQTT是一个TCP服务端,称为broker。 通过这个broker服务,我们可以作为发布者,发送一条主题消息给broker,然后其他订阅者通过消息订阅机制获得broker的主题消息推送。我们也可以作为订阅者,订阅其他发布者的主题消息。 对比MQ 消息队列存储消息,直到它们被消耗 消息队列中只有一个消费者处理消息,MQTT中订阅主题的每个订阅者都会收到消息 消息队列要提前并明确创建,MQTT中可以随时实时创建 议题 自动重连 Automatic Reconnect 离线缓存 Offline Buffering 消息持久化 Message Persistence 高可用 High Availability 安全 SSL/TLS websocket支持 连接 建立 broker开启一个host的TCP 1883端口 客户端连接Broker 如果是重连,需要带上上次ClientID 如果不是重连,可以指定CleanSession是否清空之前会话 可以指定两端之间心跳维持时间 服务端根据参数,重用或开启会话Session,绑定ClientID 一个会话,可以服务多个TCP连接,取决于是否CleanSession

MQTT.js not connecting from websockets

杀马特。学长 韩版系。学妹 提交于 2021-02-10 16:22:57
问题 I'm trying to connect to websocket client of MQTT.js but unable to get a handshake with the server. My Code : <html> <head> <title>test Ws mqtt.js</title> </head> <body> <script src="//unpkg.com/mqtt@2.5.0/dist/mqtt.min.js"></script> <script> var options = { clientId: 'service-3Kx03pKnM2', connectTimeout: 5000, hostname: 'xxx.xxx.xxx', port: 8000 }; var client = mqtt.connect(options); client.on('connect', function () { client.subscribe('presence'); client.publish('presence', 'Hello mqtt') });

MQTT.js not connecting from websockets

自古美人都是妖i 提交于 2021-02-10 16:21:46
问题 I'm trying to connect to websocket client of MQTT.js but unable to get a handshake with the server. My Code : <html> <head> <title>test Ws mqtt.js</title> </head> <body> <script src="//unpkg.com/mqtt@2.5.0/dist/mqtt.min.js"></script> <script> var options = { clientId: 'service-3Kx03pKnM2', connectTimeout: 5000, hostname: 'xxx.xxx.xxx', port: 8000 }; var client = mqtt.connect(options); client.on('connect', function () { client.subscribe('presence'); client.publish('presence', 'Hello mqtt') });

MQTT messages not received when Flask client is run behind uWSGI

自闭症网瘾萝莉.ら 提交于 2021-02-10 14:36:49
问题 I have a Flask application that subscribes to MQTT topics through a mosquitto broker (v 1.6.4). When run directly (using Flask's own server), the client connects, subscribes and receives messages. When the app is served by a uWSGI server (v 2.0.17), the client connects, subscribes but does not receive messages. The logs from the client for the two scenarios are as follows. Only in the first scenario is the message received. When run using Flask's own server: python project.py Sending CONNECT

Esp8266和HomeKit

 ̄綄美尐妖づ 提交于 2021-02-09 00:04:29
Summary 没有找到合适的简单解决方案,将Esp8266控制的设备连接到HomeKit. 所以参照EspEasy实现 HomeKit和Esp8266连接。 连接方式: Raspberry Zero Raspberry 安装homebridge-mqtt: https://www.npmjs.com/package/homebridge-mqtt 阿里云服务器 云服务器上跑以下Docker https://store.docker.com/images/eclipse-mosquitto Esp8266 Esp8266上使用Arduino烧写本项目的EasyWifi. 测试的设备: NodeMcu ESP-01S mini D1 wifi Features 可通过浏览器访问192.168.4.1,配置以下信息 设备名称 MQTT服务器 需要连接的ssid和密码 发布和订阅的主题 设备连接后,自动添加到HomeBridge Quickstart 树莓派安装homebridge ~/.homebridge/config.json 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 { "bridge": { "name": "Homebridge", "username": "B8:E8:56:17:E3:58