mqtt

paho MQTT on_message returning a funny message - python

匿名 (未验证) 提交于 2019-12-03 08:54:24
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: some help please :) I just started to play with MQTT in python. When I run the following program: import paho.mqtt.client as mqtt def on_connect(client, userdata, flags, rc): print("Connected with result code "+str(rc)) client.subscribe("watchdog/#") def on_message(client, userdata, msg): message = str(msg.payload) print(msg.topic+" "+message) client = mqtt.Client() client.username_pw_set('XXXX', password='XXXXXXX') client.on_connect = on_connect client.on_message = on_message client.connect("XXXX", XXXXX, 60) client.loop_forever() the

Paho MQTT client connection reliability (reconnect on disconnection)

℡╲_俬逩灬. 提交于 2019-12-03 07:47:19
What is the most reliable way to use the Python Paho MQTT client? I want to be able to handle connection interruptions due to WiFi drops and keep trying to reconnect until it's successful. What I have is the following, but are there any best practices I'm not adhering to? import argparse from time import sleep import paho.mqtt.client as mqtt SUB_TOPICS = ("topic/something", "topic/something_else") RECONNECT_DELAY_SECS = 2 def on_connect(client, userdata, flags, rc): print "Connected with result code %s" % rc for topic in SUB_TOPICS: client.subscribe(topic) # EDIT: I've removed this function

Max MQTT connections

◇◆丶佛笑我妖孽 提交于 2019-12-03 07:23:05
I have a need to create a server farm that can handle 5+ million connections, 5+ million topics (one per client), process 300k messages/sec. I tried to see what various message brokers were capable so I am currently using two RHEL EC2 instances (r3.4xlarge) to make lots of available resources. So you do not need to look it up, it has 16vCPU, 122GB RAM. I am nowhere near that limit in usage. I am unable to pass the 600k connections limit. Since there doesn't seem to be any O/S limitation (plenty of RAM/CPU/etc.) on either the client nor the server what is limiting me? I have edited /etc

MQTT-Client-Framework stay running at background

匆匆过客 提交于 2019-12-03 07:17:29
I'm trying to connect to our push server via MQTT-Client-Framework . There is no complication for connecting to server and with a few line of code i can connect to server and subscribe to topic. but I have a few question that I could not find any direct answer for them. 1) How can I keep my client running at background? 2) What happen after device restart? how can I automatically connect to server after device restart? 3)Suppose I got an error during connecting to server. Will this library trying to connect in a loop? how many times it try? or I need to manage this myself? 4) The same 3

MQTT on React Native?

徘徊边缘 提交于 2019-12-03 06:27:07
I'm having a hard time figuring out the right way to go when adding MQTT to a react-native project I have. The project needs to run on iOS and Android, so ideally the MQTT can be handled in the javascript side. I realize the networking lair is different from mobile to classic node, so I began down the route of forking MQTT.js and have hit roadblock after roadblock. Should I continue down the route of forking MQTT.js? Should I aim to replicate the node environment on the mobile environment with polyfills or some other means? Should I break down and get an objective C library and a Java library

Alternative to OPC-UA

前提是你 提交于 2019-12-03 05:12:37
Is there any decent alternative to OPC-UA as a solution for accessing process data of a system composed of various PLCs? Something that is platform independent and can "speak" with products of different brands ? I've heard of MQTT but it seems to be much more like a transport protocol, and only that. It does not have all the higher level stuff like the information modeling, etc. Thanks for your help! OPC is the only standard way for communicating with PLCs. OPC DA is the old alternative. OPC UA is the new one and recommended, nowadays. Before OPC there was just proprietary protocols and shared

Android & (millions of) push notifications

筅森魡賤 提交于 2019-12-03 04:57:55
问题 I'm working on the Android version of an application I first created on iPhone and this application requires to send (if it's as successful as its iPhone version) up to millions of push notifications to users daily. I naively thought the Android platform had a push notifications service as its sibling so I decided to look at this feature at the end of development and now here i am! I searched stackoverflow for answers about this feature (issue ?) and found several options (thanks guys!) BUT

Load blancing MQTT broker

拥有回忆 提交于 2019-12-03 03:40:46
Is it possible to load balance MQTT broker? Can I use ELB to load balance MQTT? Any pointers in this direction would be helpful. I hit upon http://www.slideshare.net/kellogh/mqtt-kafka-33100776 but it did not help much. Use HAProxy . A free, fast and reliable solution offering high availability, load balancing and proxying for TCP and HTTP based applications. It’s suited for very high traffic web sites. Load balancing MQTT brokers is not supported out-of-the-box by most MQTT brokers. There are brokers available which support clustering, though. Take a look at this list to find out a broker

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

匿名 (未验证) 提交于 2019-12-03 02:49:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: 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

Direct MQTT vs MQTT over WebSocket

匿名 (未验证) 提交于 2019-12-03 02:45:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: What are merits of MQTT over WebSocket compared to direct MQTT? I'm considering using MQTT in my project and so I want to know why some people choose MQTT over WebSocket instead of direct MQTT. 回答1: You should only need to run MQTT over websockets if you intend to publish/subscribe to messages directly from within webapps (in page). Basically I would run pure MQTT for everything and only add the websockets if you actually need it. For all the none browser languages the MQTT client libraries only use native MQTT. For Javascript there is both