johanmeijer / grott

Growatt inverter monitor
https://github.com/johanmeijer/grott/wiki
374 stars 103 forks source link

Please don't send each MQTT message in its own TCP connection #550

Open nwf opened 1 week ago

nwf commented 1 week ago

Rather than using paho.mqtt.publish's single method, please build a long-lived client object and use it to publish messages in turn. Establishing a new connection each time taxes the broker unnecessarily and especially so in combination with TLS (as in #377). If this would be welcome, I can try to carve out some time to raise the PR myself.