mqtt

mqtt服务器搭建

匿名 (未验证) 提交于 2019-12-02 23:43:01
windows安装 : https://developer.emqx.io/docs/broker/v3/cn/install.html#windows 如果下载速度太慢,我有迅雷会员,用迅雷速度快很多。 打开 Windows 命令行窗口,cd 到程序目录, 启动 EMQ X。 cd emqx/bin ./emqx.cmd start EMQ提供了一个后端Web控制台,用户可通过 Web 控制台,查看服务器运行状态、统计数据、客户端(Client)、会话(Session)、主题(Topic)、订阅(Subscription)、插件(Plugin)。如果EMQ安装在本机,则在浏览器打开http://127.0.0.1:18083,输入默认用户名“admin”和默认密码“public”,进入EMQ管理控制台。如下图所示,“Stats(1)”表格中,显示的是客户端和Topic的一些基本信息,比如“Clients/Count”的数目为0,表示目前连接的客户端数目为0;“Client/Max”表示的是连接曾经达到的最大值等。这里不对每项做一一介绍,读者对MQTT协议比较熟悉之后,就能理解监控仪表盘上的内容。 客户端测试 - MQTTBox windows安装: https://s3-us-west-2.amazonaws.com/workswithweb/mqttbox/latest

树莓派mqtt服务器的搭建

匿名 (未验证) 提交于 2019-12-02 23:37:01
树莓派mqtt服务器的搭建 进入树莓派官网下载树莓派系统,选择raspbian系统 选择带图形界面的系统并下载。 选择带图形界面的系统并下载。 下载etcher,将下载好的镜像文件将系统安装到内存卡中。 将树莓派接入网络:先将树莓派接上网线,另一端接入无线路由器中,将笔记本电脑连上该网络,通过路由查看树莓派的IP地址。 用命令mstsc远程连接树莓派并进入终端。 在终端搜索MQTT:apt search mqtt,如下图所示: 安装MQTT协议中 mosquitto 和mosquitto-clients,sudo apt install mosquitto-clients mosquito 文章来源: https://blog.csdn.net/zuoguaishouxiao/article/details/90755386

How can I publish to a MQTT topic in a Amazon AWS Lambda function?

自古美人都是妖i 提交于 2019-12-02 22:26:26
I would like to have an easy command like I use in the bash to publish something to a topic on MQTT inside a AWS Lambda function. Along the lines of: mosquitto_pub -h my.server.com -t "light/set" -m "on" Background: I would like to turn a lamp on and off with Alexa. Alexa can start a Lambda function, and inside of this Lambda function I would like to start an MQTT publish, because the lamp can listen to a MQTT topic and react on the messages there.(Maybe there are easier solutions, but we are in a complicated (university) network which makes many other approaches more difficult) Roy If you are

PHP MQTT 实践

匿名 (未验证) 提交于 2019-12-02 22:11:45
MQTT介绍: http://mqtt.org 服务器端 https://mosquitto.org/download/ PHP客户端 https://github.com/bluerhinos/phpMQTT MQTT QOS等级订阅和发布的关系 https://www.jianshu.com/p/ebe4b2c0461d qos = 0:仅发一次,不管是否能收到 qos = 1:没返回一直发,可能有重复接收(接收到消息可能未传递给客户端) qos = 2:保证必须收到,并且不重复(使用MSG_ID保证不重复接收) 也就是服务器只会按pub和sub两者qos等级最小的那个qos规则来发送消息。 pub时指定的qos是服务器肯定按此规则接收,但是最终订阅者不一定。 sub时指定的qos表示订阅者可以接收的最高消息等级,也就是可能收到更低等级的消息。 遇到的问题 消息发布 <?php require("../phpMQTT.php"); $server = '127.0.0.1'; // 服务器IP $port = 1883; // 服务器端口 $username = ''; // 用户名 $password = ''; // 密码 $client_id = 'pub_' . uniqid(); $mqtt = new Bluerhinos\phpMQTT($server,

C# Mqtt 断线重连

匿名 (未验证) 提交于 2019-12-02 22:09:29
在通过 MqttClient 客户端连接之后,在服务端服务重启时,客户端如果没有重连机制,则无法再接收到订阅的消息。 使用的 Mqtt 组件为:M2Mqtt.Net.dll (1)如果提供的服务端地址是不可解析的,会引发异常无法实例化 MqttClient 对象。 (2)Connect 无法连接时会引发异常,IsConnected 为 false。 (3)服务端断开会触发客户端的 ConnectionClosed 事件,IsConnected 为 false。 (4)重新 Connect 需要重新 Subscribe 订阅主题。 (5)MqttClient.Subscribe 第一个参数为订阅主题数组,第二个为相应的 qosLevel,两个数组长度必须一致,否则会异常。 // 自动重连主体 private void _TryContinueConnect() { if (IsConnected) return; Thread retryThread = new Thread(new ThreadStart(delegate { while (_MqttClient == null || !_MqttClient.IsConnected) { if (_ToClose) break; if (_MqttClient == null) { _BuildClient(); Thread

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

五迷三道 提交于 2019-12-02 21:20:54
问题 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(), )

IoT request response protocol

别来无恙 提交于 2019-12-02 20:58:58
We need to build a server that can communicate with some embedded devices running a variant of Android. We need to be able to send commands to the device, and receive a response. A simple command might be asking the device for it's status. We won't have HTTP, so we need to have the client/device establish a connection with the server. We were considering using MQTT as it has a lot of nice properties (QoS, lightweight, built for IoT), but it doesn't natively support a request response workflow. We have considered building RPC on top of MQTT, but before we do I just wanted peoples thoughts on

硬件使用说明

 ̄綄美尐妖づ 提交于 2019-12-02 20:31:31
前言 一,该程序需要的基础知识: https://www.cnblogs.com/yangfengwu/category/1566194.html 所有源码开源,请自行学习    二,此程序兼容SIM800 如果想绑定SIM800,请把其IMEI号,生成二维码,用手机APP扫描. 实现功能概要   GPRS模块发布的主题: device/设备IMEI号  GPRS模块订阅的主题: user/设备IMEI号   APP通过扫描二维码获取GPRS设备的IMEI号,然后设置订阅的主题:device/设备IMEI号  发布的主题:user/设备IMEI号   注:实际上和上一节代码唯一不同的地方是控制GPRS连接TCP服务器,然后实现透传.其它程序完全一致!   后面再有一两节,我便告诉大家如何移植当前我的MQTT处理程序到自己的项目,只要自己的模块可以实现TCP,便一定可以实现MQTT   因为本身MQTT就是个TCP服务器而已.你按照他给的规定发数据,它就帮你转发数据了而已.   我当时封包就是为了大家无论用的什么模块,都可以分分钟移植上MQTT!   授人予鱼,就要给一条有很大价值的鱼!   说实话哈,我用我的包移植上这个程序,只用了不到10分钟.其实如果有现成稳定的流程的知道怎么控制模块连接TCP了,也就5分钟. 一,硬件程序    1.1:

mqtt mosquitto linux connection limit

﹥>﹥吖頭↗ 提交于 2019-12-02 19:42:40
How are users getting past a 1024 connection limit in Linux in association with doing MQTT for push notification? I am using Mosquitto server, which I think I read does not have a 1024 connection limit built into the linux version. So, can I use a single server (no bridging etc) and get 5,000, 10,000+ users? Or, do I absolutely need bridging? I haven't seen a lot of writing on how this is setup other than the config settings man page for mosquitto. Or, can I get by with just modify a few linux configuration settings and I'm good to go with a single mosquitto server? My app is more or less an

MQTT on Arduino not working

时间秒杀一切 提交于 2019-12-02 17:23:31
问题 I'm using Arduino Uno and Wi-Fi shield. I'm trying to implement MQTT protocol for communication and I tried two libraries for Arduino. First one is Knolleary's PubSubClient: http://pubsubclient.knolleary.net/ . I modified original example a little bit to use WiFi module instead of ethernet. Sending works but not every time (sometimes, the message is sent and sometimes not). But receiving via callback function doesn't work at all. Here is my code: /* Basic MQTT example with Authentication -