0

character limit on subscribe example
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

character limit on subscribe example

by ncoleman3 on Tue Jun 25, 2019 1:38 pm

Hi, I'm working through the adafruit.io example sketches and I seem to have run into a limit on the number of characters that can be received on the Huzzah ESP8266. I'm trying to send text and I can only get the first 50 characters of whatever I send. <50, no problem, but >50 and the message gets clipped. On my adafruit.io feed, the full message is fully visible. I'm using the "add data" button to generate these messages.

ncoleman3
 
Posts: 5
Joined: Fri Jun 07, 2019 4:38 pm

Re: character limit on subscribe example

by ncoleman3 on Tue Jun 25, 2019 1:44 pm

I should also mention that if it is a really large message (I haven't tested the lower limit, but at least 110 characters), the message will not come through the serial port at all, though it does show up on the IO feed. If it is just a little bigger (55 chars for example), the message will show on the serial monitor but will be clipped.

ncoleman3
 
Posts: 5
Joined: Fri Jun 07, 2019 4:38 pm

Re: character limit on subscribe example

by brubell on Wed Jun 26, 2019 1:45 pm

The maximum amount of data which can be received from Adafruit IO using the Adafruit IO Arduino library is 45 characters.

Code: Select all | TOGGLE FULL SIZE
// Maximum length of data sent/recieved from Adafruit IO
#define AIO_DATA_LENGTH 45


You could try increasing it, it's within the arduino library on the following line:
https://github.com/adafruit/Adafruit_IO ... ions.h#L86

brubell
 
Posts: 496
Joined: Fri Jul 17, 2015 10:33 pm

Re: character limit on subscribe example

by ncoleman3 on Thu Jun 27, 2019 12:24 pm

Thanks, brubell! I was able to increase the limit by altering the library. Is there a theoretical limit to how many characters I could send? I'm not going to try sending the full text of War & Peace or anything, but should I be worried about breaking something if I bump it up too high?

ncoleman3
 
Posts: 5
Joined: Fri Jun 07, 2019 4:38 pm

Re: character limit on subscribe example

by brubell on Fri Jun 28, 2019 10:04 am

ncoleman3 wrote:Thanks, brubell! I was able to increase the limit by altering the library. Is there a theoretical limit to how many characters I could send? I'm not going to try sending the full text of War & Peace or anything, but should I be worried about breaking something if I bump it up too high?


The MQTT Spec defines the limit as 256MB (http://docs.oasis-open.org/mqtt/mqtt/v3 ... c442180836).

While this may be great for a larger-scale project, we are working with memory-constrained embedded systems. Keeping the message size down (packing as much content as possible into a message) and the topic string size small are good practices.

brubell
 
Posts: 496
Joined: Fri Jul 17, 2015 10:33 pm

Re: character limit on subscribe example

by abachman on Fri Jun 28, 2019 10:30 am

For Adafruit IO in particular, 1024 bytes is the limit for feeds that have history turned on (i.e., we're storing every message) and 102400 bytes for feeds that have history turned off (we're only storing the last message). If the messages are larger than those sizes, you'll get an error and the data won't be stored.


- adam b.

abachman
 
Posts: 327
Joined: Mon Feb 01, 2010 12:48 pm

Please be positive and constructive with your questions and comments.