mqtt

Background Services are restricted in Xiaomi and Oppo

别说谁变了你拦得住时间么 提交于 2020-01-09 05:27:30
问题 We are developing an app With MQTT running in a foreground service. The problem is on Xiaomi Redmi Note 7, the service gets killed after we kill the app but on other brands It works fine. I did not test the app on Oppo and Vivo but as I searched they have problem too. In onCreate method of the service, I called startForeground(NOTIFICATION_ID, notification) and my service declaration in manifest is like this <service android:name=".service.mqtt.MqttService" android:enabled="true" android

Background Services are restricted in Xiaomi and Oppo

旧巷老猫 提交于 2020-01-09 05:27:07
问题 We are developing an app With MQTT running in a foreground service. The problem is on Xiaomi Redmi Note 7, the service gets killed after we kill the app but on other brands It works fine. I did not test the app on Oppo and Vivo but as I searched they have problem too. In onCreate method of the service, I called startForeground(NOTIFICATION_ID, notification) and my service declaration in manifest is like this <service android:name=".service.mqtt.MqttService" android:enabled="true" android

物联网应用层协议选择和分析--MQTT、CoAP 、HTTP、XMPP、SoAP

心已入冬 提交于 2020-01-07 17:05:04
MQTT协议 MQTT(Message Queuing Telemetry Transport,消息队列遥测传输)最早是IBM开发的一个即时通讯协议,MQTT协议是为大量计算能力有限且工作在低带宽、不可靠网络的远程传感器和控制设备通讯而设计的一种协议。 MQTT协议的优势是可以支持所有平台,它几乎可以把所有的联网物品和互联网连接起来。 它具有以下主要的几项特性: 1、使用发布/订阅消息模式,提供一对多的消息发布和应用程序之间的解耦; 2、消息传输不需要知道负载内容; 3、使用 TCP/IP 提供网络连接; 4、有三种消息发布的服务质量: QoS 0:“最多一次”,消息发布完全依赖底层 TCP/IP 网络。分发的消息可能丢失或重复。例如,这个等级可用于环境传感器数据,单次的数据丢失没关系,因为不久后还会有第二次发送。 QoS 1:“至少一次”,确保消息可以到达,但消息可能会重复。 QoS 2:“只有一次”,确保消息只到达一次。例如,这个等级可用在一个计费系统中,这里如果消息重复或丢失会导致不正确的收费。 5、小型传输,开销很小(固定长度的头部是 2 字节),协议交换最小化,以降低网络流量; 6、使用 Last Will 和 Testament 特性通知有关各方客户端异常中断的机制; 在MQTT协议中,一个MQTT数据包由:固定头(Fixed header)、 可变头(Variable

mqtt协议系统设计参考

蓝咒 提交于 2020-01-07 15:52:39
作者:极寒 链接:https://zhuanlan.zhihu.com/p/28525517 来源:知乎 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。 回顾自己的工作经历最遗憾的是没有用代码实现设计好的系统就匆匆离职了!写这篇文章主要目的是分享一下实现通信服务的思路,方便大家设计自己的通信服务,也希望通过分享实践知道设计中的不足。工作的公司是做电动汽车充电的可以说是一个很伟大的物联网项目,一个EVCS系统(Electric vehicle charging system)包括APP、云平台、充电桩、电动汽车等部分。在云平台众多的服务中通信服务是一个负责接入嵌入式网关和与后端业务服务相协调的中间件。今天主要根据自己的经历分享一下通信服务的实现细节,其中包括具体实践的也有针对系统缺陷做的一些思考。本文内容不局限于电动汽车充电系统只是以电动汽车充电系统为例,也可以作为基于mqtt协议系统的设计参考。 术语说明 嵌入式网关:它一般由嵌入式微处理器、外围硬件设备、嵌入 式操作系统以及用户的应用程序等四个部分组成。在本系统中负责继电器的开关以及与服务器的网络通信。 充电设备(充电桩):给电动汽车充电的设备通过充电枪与车连接,里面包含了一个嵌入式网关。 comm:一个需要我们实现的broker扩展程序,communication 的简称。 通信服务

iOS 整理消息列表Demo<二>

筅森魡賤 提交于 2020-01-07 04:10:31
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 还是上一篇的消息列表,不过这次类型可能不止三个,要怎么做呢?参考一下别人的代码 ,跟读记录一下: 阅读代码,消息列表,多种类型,列表里有重复类型的消息,比如 聊天 可能是不同的人,别的公告什么的是一样的,只显示一行,其他有的类型可能是多行。 数据源: self.messageList 数组。 进入页面通过 tableview主动刷新 ,先链接 MQTT 注册 MQTT 然后去请求接口: 接口: xxx_list 返回了一个list的 message 的 model. 然后请求 session LIst 接口: CMD:@“xxxx_sessions" 不传参数。 然后遍历返回的 data数据数组: 去找是否有 会议类型的,如果有的话就加到 self.messageList 。 然后 :请求列表每项的未读数和最新一条消息 cmd:xxx_notices 传入 id 从 messageList 数组里遍历 model 拿到外面的 ID , 然后把返回来的 对应 list 的 model 一个个赋值给: temp.accountNotice = accountNoticeListDicModel.data[i]; 每赋值一个,给 model里的 计数属性字段加 1. 临时创建一个局部变量数组 把配置好的 临时

发布说明

白昼怎懂夜的黑 提交于 2020-01-06 23:30:03
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> Kuiper 团队宣布发布 Kuiper 0.1。Kuiper 0.1 可以从这里下载 。 EMQ X Kuiper 是 Golang 实现的轻量级物联网边缘分析、流式处理开源软件,可以运行在各类资源受限的边缘设备上。Kuiper 设计的一个主要目标就是将在云端运行的实时流式计算框架(比如 Apache Spark , Apache Storm 和 Apache Flink 等)迁移到边缘端。Kuiper 参考了上述云端流式处理项目的架构与实现,结合边缘流式数据处理的特点,采用了编写基于 源 (Source) , SQL (业务逻辑处理) , 目标 (Sink) 的规则引擎来实现边缘端的流式数据处理。 网址: https://www.emqx.io/products/kuiper Github仓库: https://github.com/emqx/kuiper 概览 功能 性能优化 提供了针对 Kuiper 规则设置并发度的配置选项,在不同的场景下可以对其优化 在 source 里的 concurrency 设置:设置运行的协程数,默认值为1。如果设置协程数大于1,必须使用共享订阅模式。 在 sink 里的 concurrency 设置:设置运行的线程数。该参数值大于1时,消息发出的顺序可能无法保证。 在

MQTT (Mosquitto) Connection pool?

蹲街弑〆低调 提交于 2020-01-06 20:24:29
问题 What would you suggest for Mosquitto connection pooling in Java? We are wasting (blocking) too much time on establishing each connection, so we think some kind of reuse would be better. 回答1: I'd suggest using the generic object pooling in the Apache commons tools https://commons.apache.org/proper/commons-pool/ But also you could extend Thread to instantiate a MQTT connection object on creation and have a persistent connection per thread. This could be combined with the built in thread pool in

MQTT (Mosquitto) Connection pool?

青春壹個敷衍的年華 提交于 2020-01-06 20:24:15
问题 What would you suggest for Mosquitto connection pooling in Java? We are wasting (blocking) too much time on establishing each connection, so we think some kind of reuse would be better. 回答1: I'd suggest using the generic object pooling in the Apache commons tools https://commons.apache.org/proper/commons-pool/ But also you could extend Thread to instantiate a MQTT connection object on creation and have a persistent connection per thread. This could be combined with the built in thread pool in

Trouble connecting NodeMCU to Microsoft Azure IoT Hub

让人想犯罪 __ 提交于 2020-01-06 19:53:14
问题 I am trying to connect my ESP8266, running the latest NodeMCU build, to a Microsoft Azure IoT Hub via MQTT Protocol. It appears that this is possible, as it is shown here... http://thinglabs.io/workshop/esp8266/sending-d2c-messages/ I am using the correct syntax as far as I can see from the MS Azure help... https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-mqtt-support Unlike the example in ThingLabs, which creates a SAS token using NodeMCU, I have followed the MS document and generated

MOsquitto unexpected disconnection

妖精的绣舞 提交于 2020-01-06 19:29:40
问题 I am using python mosquitto(paho) library. I got the problem of Unexpected disconnection. I found constantly dropping and connection with the server. . I am unable to find the problem. some times it shows [Error 104] connection reset by peer. I hosted my broker on amazon web services... my error is --- Connected to xx.xx.xx.xx:1883 Unexpected disconnection. Connected to xx.xx.xx.xx:1883 Unexpected disconnection. Connected to xx.xx.xx.xx:1883 I am passing QOS=2, retain = true, clean session