Hi, I'm new to the use of ESP and MQTT, I'm currently working on a NodeMCU v1.0. I would like to know what is the new limit length for the messages, I'm currently able to receive a 1011B payload using Mosquitto broker but I'm aiming for a 40MB payload, is this possible?
void callback(const MQTT::Publish& pub) {
Serial.println("callback");
/*
Serial.print(pub.topic());
Serial.print(" => ");
if (pub.has_stream()) {
Serial.println("Aca2");
uint8_t buf[BUFFER_SIZE]; //Inicializa el buffer
int read; //Inicializa un int para
Serial.println(pub.payload_len());
while (read = pub.payload_stream()->read(buf, BUFFER_SIZE)) {
Serial.write(buf, read);
}
pub.payload_stream()->stop();
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println();
Serial.println();
pinMode(LED_BUILTIN, OUTPUT);
//Inicializacion para comunicacion SPI
pinMode(D1, INPUT); //output from display /TC_BUSY (if 0=busy if 1=ready to receive new commands)
pinMode(D2, OUTPUT); //TC_EN (1=disabled 0=enabled)
if (WiFi.status() == WL_CONNECTED) {
if (!client.connected()) {
if (client.connect("Blue")) { //Id del dispositivo
client.set_callback(callback); //callback, que va a hacer cuando reciba un mensaje
client.subscribe("demo/board2", 2); //topic al que esta subscrito, usar una variable
}
}
if (client.connected())
client.loop(); //Wait for packets to come in, processing them.
Serial.println("loop");
}
//Para verificar que esta funcionando
digitalWrite(LED_BUILTIN, LOW); //Enciende led
delay(200);
digitalWrite(LED_BUILTIN, HIGH); //Apaga led
delay(200);
}`
Hi, I'm new to the use of ESP and MQTT, I'm currently working on a NodeMCU v1.0. I would like to know what is the new limit length for the messages, I'm currently able to receive a 1011B payload using Mosquitto broker but I'm aiming for a 40MB payload, is this possible?
My code:
`#include
include
include
const char ssid = "xxxxx"; const char pass = "xxxxxxx";
IPAddress ip(192,168,200,60); // Blue 192,168,200,60 White 192,168,200,70 IPAddress subnet(255,255,255,0); IPAddress gateway(192,168,200,1);
IPAddress server(192,168,200,80); //Broker MQTT
WiFiClient wclient; PubSubClient client(wclient, server);
define BUFFER_SIZE 150000
void callback(const MQTT::Publish& pub) { Serial.println("callback"); /* Serial.print(pub.topic()); Serial.print(" => "); if (pub.has_stream()) { Serial.println("Aca2"); uint8_t buf[BUFFER_SIZE]; //Inicializa el buffer int read; //Inicializa un int para Serial.println(pub.payload_len());
} else { //Serial.println(pub.payload_string());
} */ }
void setup() { // put your setup code here, to run once: Serial.begin(115200); Serial.println(); Serial.println();
pinMode(LED_BUILTIN, OUTPUT);
//Inicializacion para comunicacion SPI pinMode(D1, INPUT); //output from display /TC_BUSY (if 0=busy if 1=ready to receive new commands) pinMode(D2, OUTPUT); //TC_EN (1=disabled 0=enabled)
digitalWrite(D2, HIGH); Serial.println("/TC_EN: "); Serial.println(digitalRead(D2));
digitalWrite(D2, LOW); //to enable /TC_EN Serial.println("/TC_EN: "); Serial.println(digitalRead(D2));
SPI.begin(); pinMode(SS,OUTPUT);
digitalWrite(SS, HIGH); Serial.println("/TC_CS: "); Serial.println(digitalRead(SS));
delay(1); }
void loop() { // Para conectar al WiFi if (WiFi.status() != WL_CONNECTED) { Serial.print("Connecting to "); Serial.print(ssid); Serial.println("."); WiFi.begin(ssid, pass); WiFi.config(ip, gateway, subnet);
}
if (WiFi.status() == WL_CONNECTED) { if (!client.connected()) { if (client.connect("Blue")) { //Id del dispositivo client.set_callback(callback); //callback, que va a hacer cuando reciba un mensaje client.subscribe("demo/board2", 2); //topic al que esta subscrito, usar una variable } }
}
//Para verificar que esta funcionando digitalWrite(LED_BUILTIN, LOW); //Enciende led delay(200); digitalWrite(LED_BUILTIN, HIGH); //Apaga led delay(200); }`
When I send a 1012B message I get this exception:
Exception (9): epc1=0x40203dc4 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000005 depc=0x00000000
ctx: cont sp: 3ffef590 end: 3ffef820 offset: 01a0
Since I'm new to this I don't really know what to do to solve it. Great work, thanks for the library!