rate limit on publishing messages?
Hi Roger
I have been using your mosquitto server code since the release of the first version. Thanks for a fine piece of work.
I am working on a project now which is using MQTT to publish active badge data from the openbeacon.org project. I have purchased 100 badges from Bitmanufactur in Germany and these appear to be working well. I have a previous student project which replaced their custom built Easy Reader hardware (used to collect and transfer the data from each badge to a server process) with an opensource Netduino board + a Sparkfun nRF24L01+ breakout board. This worked well, until we changed our desktop IP network address. That change required a recompilation of the software(??), and the student who reloaded the software started blowing up the Netduinos (a known problem when reflashing memory). Rather than waste anymore time on these (now obsolete) boards, I decided to try to use a Raspberry Pi as the basis of the badge reader.
I now have an Arduino Uno + Sparkfun nRF24L01+ breakout board capturing badge packets and forwarding these over the serial link (115200 baud) to the Raspberry Pi. I have re-writeen the reader software from the Openbeacon, now in Python (and way, way more readable at 2 pages of A4 total). The original software called for the data to be forwarded to downstream software agents on UDP port 2432. I decided to use MQTT and pump this data up to our mosquitto server.
The data from each badge arrives about every 6 seconds.
When I trace the badge data (without sending the data to mosquitto) I can see this happening at about that speed. I have a 'while 1:' loop that reads the badge and then does some processing, then prints the data to the screen. All looks fine at this point.
When I add 'rc = mqttc.loop()' into the loop (leaving 'publish' out for the moment), traces of the badge data are now printed to the screen about once a second - I can match this to the tick of the clock outside my door :-).
DETAILS:
Mosquitto Version 1.1
Python (Mac OS X) Version 2.7
QUESTION:
Does 'mqttc.loop()' introduce a time delay into its response? If so, can I turn it off?
I need to be able to pump the data up to the server at a pretty steady rate. I expect to have up to 100 badges in range of the reader at times, and so need to be able to handle 100 messages per 6 seconds, or 1000 messages per minute. Is this possible?
Yes, I might have to update the 16 MHz Arduino Uno before then, but that plan is in process.
Any advice would be great. Especially if what I am doing has a very obvious error in it. :)
Cheers
Mark
==== python code extract ======
while rc == 0:
try:
data = readTagData()
g_Beacon = bytearray()
g_hdr = bytearray()
time_stamp = int(time.time())
g = struct.
g_hdr = bytearray(
reader_sequence = reader_sequence + 1
# .icrc16 header checksum
g_all = struct.Struct('>H')
crc = 0xffff ^ xxtea.crc16(
g_Beacon = bytearray(
g_Beacon.
# add the body of the header to the CRC16 of the header (wierd layout??)
s = binascii.
print s + data
# mqttc.publish(
rc = mqttc.loop()
except KeyboardInterrupt:
break
=======
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- mosquitto Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask mschulz for more information if necessary.