Two SSL simultaneous connections trouble
Is your question related to a problem? Please describe.
The project has been realized on LilyGo-T-Call-SIM800L, Everything was fine with SSL connection with my own domain based MQTT broker having used the TinyGSM library. Then I have decided to use also a Telegram bot and get notifications on own channel on-demand. It's "Universal Telegram Bot Library" used. Upon GPRS successful connection an Telegram alert comes, again successfully. Since then MQTT publishing is too successful, but when the publishing on MQTT and on Telegram have significant shift in time domain. Adjacent commands of MQTT then Telegram messages publishing or vice versa, crushes the SSL connection with broker. Some milliseconds delay adding in between two publishing does not fix the problem.
Terminal view log:
01:21:26.084 -> Message arrived on topic: esp/whatsapp. Message: true 01:21:29.720 -> (SSLClient)(SSL_ERROR)(available): SSL engine failed to update. 01:21:29.720 -> (SSLClient)(SSL_ERROR)(available): Cannot operate on a closed SSL connection.
The code portion which makes the crush:
else if (String(topic) == "esp/whatsapp") { if (messageTemp == "true") { whatsappflag = !whatsappflag; if (whatsappflag) { mqtt.publish(topicWhatsappStatus, "green"); if (startflag) mqtt.publish(topicEnginestatus, "green"); else mqtt.publish(topicEnginestatus, "red"); if (armstatusflag) mqtt.publish(topicarm, "green"); else { mqtt.publish(topicarm, "red"); } bot.sendMessage(CHAT_ID, "Whatsapp flag set!!", ""); SerialMon.println("Whatsapp flag set"); } else mqtt.publish(topicWhatsappStatus, "red"); SerialMon.println("Changing Whatsapp to " + (String(whatsappflag))); } }