Time for better WiFI - UniFi APs perhaps? - MQTT disconnect / socket error

I’m having issues with a couple of Tasmota flashed Sonoffs (1 x 4CH Pro v2 and 2 x Sonoff Basics) that will drop signal for a very short period of time, all of the time. Can anyone suggest what might be causing this issue?

I’m thinking it’s either poor wifi signal, interference or my ISP supplied router / AP not being man enough to cope with all of the wifi devices on the network - which is about 40 or so. I have 15 Sonoffs running Tasmota, one nodeMCU board, a TP-Link smart socket, 3 laptops, 4 phones, 6 google devices, amazon firestick and a couple of tablets. Not everything is connected at any one time apart from the smart switches, which all are.

I’m assuming this is actually a wifi issue, rather than a MQTT issue but i do have a lot of problems with two out of the three devices dropping from the broker due to socket error but i am wondering if poor wifi is causing this?

[> INFO] found MQTT-USER on local database

1548086762: New client connected from 192.168.1.38 as controller_DVES_B4D67A (c1, k10, u'MQTT-USER').
1548086790: Socket error on client controller_DVES_B4D67A, disconnecting.
1548086791: New connection from 192.168.1.38 on port 1883.
[INFO] found MQTT-USER on local database
1548086791: New client connected from 192.168.1.38 as controller_DVES_B4D67A (c1, k10, u'MQTT-USER').
1548086825: Client controller_DVES_B4D67A has exceeded timeout, disconnecting.
1548086825: Socket error on client controller_DVES_B4D67A, disconnecting.
1548086838: New connection from 192.168.1.38 on port 1883.
[INFO] found MQTT-USER on local database
1548086838: New client connected from 192.168.1.38 as controller_DVES_B4D67A (c1, k10, u'MQTT-USER').
1548086873: Client controller_DVES_B4D67A has exceeded timeout, disconnecting.
1548086873: Socket error on client controller_DVES_B4D67A, disconnecting.
1548086875: New connection from 192.168.1.38 on port 1883.
[INFO] found MQTT-USER on local database
1548086875: New client connected from 192.168.1.38 as controller_DVES_B4D67A (c1, k10, u'MQTT-USER').
1548086903: Socket error on client controller_DVES_B4D67A, disconnecting.
1548086904: New connection from 192.168.1.38 on port 1883.
[INFO] found MQTT-USER on local database
1548086904: New client connected from 192.168.1.38 as controller_DVES_B4D67A (c1, k10, u'MQTT-USER').
1548086925: Socket error on client controller_DVES_B4D67A, disconnecting.
1548086935: New connection from 192.168.1.38 on port 1883.
[INFO] found MQTT-USER on local database
1548086935: New client connected from 192.168.1.38 as controller_DVES_B4D67A (c1, k10, u'MQTT-USER').
1548086953: Socket error on client controller_DVES_B4D67A, disconnecting.
1548086954: New connection from 192.168.1.38 on port 1883.
[INFO] found MQTT-USER on local database
1548086954: New client connected from 192.168.1.38 as controller_DVES_B4D67A (c1, k10, u'MQTT-USER').
1548087003: Socket error on client controller_DVES_B4D67A, disconnecting.
1548087003: New connection from 192.168.1.38 on port 1883.
[INFO] found MQTT-USER on local database
1548087003: New client connected from 192.168.1.38 as controller_DVES_B4D67A (c1, k10, u'MQTT-USER').
1548087026: Socket error on client controller_DVES_B4D67A, disconnecting.
1548087027: New connection from 192.168.1.38 on port 1883.
[INFO] found MQTT-USER on local database
1548087027: New client connected from 192.168.1.38 as controller_DVES_B4D67A (c1, k10, u'MQTT-USER').
1548087051: Client controller_DVES_B4D67A has exceeded timeout, disconnecting.
1548087051: Socket error on client controller_DVES_B4D67A, disconnecting.
1548087063: New connection from 192.168.1.38 on port 1883.
[INFO] found MQTT-USER on local database
1548087063: New client connected from 192.168.1.38 as controller_DVES_B4D67A (c1, k10, u'MQTT-USER').
1548087067: Client ElecHeater_DVES_B4E11E has exceeded timeout, disconnecting.
1548087067: Socket error on client ElecHeater_DVES_B4E11E, disconnecting.
1548087078: New connection from 192.168.1.7 on port 1883.
[INFO] found MQTT-USER on local database
1548087078: New client connected from 192.168.1.7 as ElecHeater_DVES_B4E11E (c1, k10, u'MQTT-USER').
1548087082: Socket error on client controller_DVES_B4D67A, disconnecting.
1548087082: New connection from 192.168.1.38 on port 1883.
[INFO] found MQTT-USER on local database
1548087082: New client connected from 192.168.1.38 as controller_DVES_B4D67A (c1, k10, u'MQTT-USER').
1548087128: Socket error on client controller_DVES_B4D67A, disconnecting.
1548087129: New connection from 192.168.1.38 on port 1883.
[INFO] found MQTT-USER on local database
1548087129: New client connected from 192.168.1.38 as controller_DVES_B4D67A (c1, k10, u'MQTT-USER').
1548087136: Socket error on client ElecHeater_DVES_B4E11E, disconnecting.
1548087136: New connection from 192.168.1.7 on port 1883.
[INFO] found MQTT-USER on local database
1548087136: New client connected from 192.168.1.7 as ElecHeater_DVES_B4E11E (c1, k10, u'MQTT-USER').
1548087153: Client controller_DVES_B4D67A has exceeded timeout, disconnecting.
1548087153: Socket error on client controller_DVES_B4D67A, disconnecting.
1548087162: New connection from 192.168.1.38 on port 1883.
[INFO] found MQTT-USER on local database
1548087162: New client connected from 192.168.1.38 as controller_DVES_B4D67A (c1, k10, u'MQTT-USER').
1548087202: Socket error on client ElecHeater_DVES_B4E11E, disconnecting.
1548087202: New connection from 192.168.1.7 on port 1883.
[INFO] found MQTT-USER on local database
1548087202: New client connected from 192.168.1.7 as ElecHeater_DVES_B4E11E (c1, k10, u'MQTT-USER').
1548087216: Socket error on client controller_DVES_B4D67A, disconnecting.
1548087217: New connection from 192.168.1.38 on port 1883.
[INFO] found MQTT-USER on local database
1548087217: New client connected from 192.168.1.38 as controller_DVES_B4D67A (c1, k10, u'MQTT-USER').
1548087275: Socket error on client controller_DVES_B4D67A, disconnecting.
1548087276: New connection from 192.168.1.38 on port 1883.
[INFO] found MQTT-USER on local database
1548087276: New client connected from 192.168.1.38 as controller_DVES_B4D67A (c1, k10, u'MQTT-USER').
1548087287: Client ElecHeater_DVES_B4E11E has exceeded timeout, disconnecting.
1548087287: Socket error on client ElecHeater_DVES_B4E11E, disconnecting.
1548087288: New connection from 192.168.1.7 on port 1883.
[INFO] found MQTT-USER on local database
1548087288: New client connected from 192.168.1.7 as ElecHeater_DVES_B4E11E (c1, k10, u'MQTT-USER').
1548087308: Socket error on client controller_DVES_B4D67A, disconnecting.
1548087309: New connection from 192.168.1.38 on port 1883.
[INFO] found MQTT-USER on local database
1548087309: New client connected from 192.168.1.38 as controller_DVES_B4D67A (c1, k10, u'MQTT-USER').
1548087336: Socket error on client controller_DVES_B4D67A, disconnecting.
1548087347: New connection from 192.168.1.38 on port 1883.
[INFO] found MQTT-USER on local database
1548087347: New client connected from 192.168.1.38 as controller_DVES_B4D67A (c1, k10, u'MQTT-USER').
1548087390: Socket error on client controller_DVES_B4D67A, disconnecting.
1548087391: New connection from 192.168.1.38 on port 1883.
[INFO] found MQTT-USER on local database
1548087391: New client connected from 192.168.1.38 as controller_DVES_B4D67A (c1, k10, u'MQTT-USER').
1548087475: Socket error on client controller_DVES_B4D67A, disconnecting.
1548087485: New connection from 192.168.1.38 on port 1883.
[INFO] found MQTT-USER on local database
1548087485: New client connected from 192.168.1.38 as controller_DVES_B4D67A (c1, k10, u'MQTT-USER').
1548087507: Socket error on client controller_DVES_B4D67A, disconnecting.
1548087508: New connection from 192.168.1.38 on port 1883.
[INFO] found MQTT-USER on local database
1548087508: New client connected from 192.168.1.38 as controller_DVES_B4D67A (c1, k10, u'MQTT-USER').

As a side note, all wifi smart devices are talking to my broker via single Username, does Mosquitto broker v4 have any connection limitations i’m not aware of?

Running

Ri Pi v3 B
HassOS 1.11
HA v0.83.2

You should probably try with an AP juggling Layer 2 only and a separate router juggling layer 3 and giving out DHCP addresses through leases.
By splitting tasks it should become clearer where the bottleneck is.

PS: OpenWRT as an access point OS allows you to do a lot of network tweaking.