I've accepted Anthony's challenge to squeeze more from the ESP8266 as MQTT broker so I managed to increase the maximum number of simultaneous subscribers on a single ESP8266.
Now instead of 9 like I had before ( plus bridge to/from cloud and websockets to connect my mobile app to ESP8266 MQTT broker) I have 20 stable subscribers.
Top was 30 but the heap memory was too low to have flawless connections to all subscribers.
Also a good news is that this is not limiting the number of topics a device can subscribe to the broker ( in a reasonable number of 4 or 5 topics per device).
A picture with 25 connections and one with websocket.
|ESP8266 as MQTTbroker|
At the beginning I have 35Kb and after 25+1+1 connections I am ending with 11 to 12 Kb of heap memory which is plenty even for bigger payloads.
Mqtt broker on ESP8266 #4
Mqtt broker on ESP8266 #3
Mqtt broker on ESP8266 #2
Mqtt broker on ESP8266 #1