I have been watching this logs few hours already and as I asked in my first post I think that something is wrong with Mosquitto config.
First part of logs is fine in my opinion:
" 14114> MQTT connectedCb=dfd
14114> MQTT: Connected Cb=0x00000dfd
14115> cmdResponse: cmd=3 val=3581 argc=0
14938> SLIP: start or end len=0 inpkt=1
14938> SLIP: start or end len=50 inpkt=1
14939> cmdParsePacket: cmd=12 argc=2 value=0
14939> cmdExec: Dispatching cmd=MQTT_SUB
14939> MQTT: MQTTCMD_Subscribe topic=maciek/xxxxx/topic/command, qos=0
14939> MQTT: Subscribe, topic: "maciek/xxxxx/topic/command"
14939> MQTT: Send type=SUBSCRIBE id=0001 len=39
14951> MQTT: Recv type=SUBACK id=0001 len=5; Pend type=SUBSCRIBE id=01
15190> Wifi check: mode=AP+STA status=5
15190> Wifi got IP. Going into STA mode..
15191> bcn 0
15191> del if1
15191> pm open,type:2 0
15191> mode : sta(40:f5:20:2d:9b:7f)
30244> Wifi check: mode=STA status=5
47282> HTTP GET /home.html: 200, 65ms, h=15400
...."
All strange things starts when I send command but not always. If I send command just after controller publish topic log/maciek/xxxx controller publish response. But only few seconds.
"707856> MQTT Client: Received topic: maciek/xxxx/topic/command, data: 2,0,0,0,K
707856> MQTT: Data cb=0x00000e0f topic=maciek/xxxx/topic/command2,0,0,0,K len=9
707857> cmdResponse: cmd=3 val=3599 argc=2
707901> SLIP: start or end len=0 inpkt=1
707910> SLIP: start or end len=108 inpkt=1
707910> cmdParsePacket: cmd=11 argc=5 value=0
707910> cmdExec: Dispatching cmd=MQTT_PUB
707910> MQTT: MQTTCMD_Publish topic=maciek/xxxx/topic/response, data_len=39, qos=0, retain=0
707911> MQTT: Publish, topic: "maciek/xxxx/topic/response", length: 76
707911> MQTT: Send type=PUBLISH id=0000 len=76
709754> MQTT: Recv type=PUBLISH id=0000 len=45; Pend type=NULL id=00"
and after next command send:
"771172> MQTT: MQTTCMD_Subscribe topic=maciek/xxxx/topic/command, qos=0
771172> MQTT: Subscribe, topic: "maciek/xxxx/topic/command"
771173> MQTT: Send type=SUBSCRIBE id=000A len=39
771178> MQTT: Recv type=SUBACK id=000A len=5; Pend type=SUBSCRIBE id=0A
773129>
[b][u]773129> MQTT ERROR: Keep-alive timed out[/u][/b]
773129> MQTT: Disconnecting from 89.71.76.194:1883 (0x3fff7a38)
773130> MQTT Client: Disconnected
773130> MQTT: Disconnected cb=0x00000e03
773130> cmdResponse: cmd=3 val=3587 argc=0
773131> MQTT: Disconnect CB, freeing espconn 0x3fff7a38"
Sorry for long post but I also add short log from Mosquitto:
"1639085754: Received PUBLISH from maciek_PC MQTT.fx (d0, q0, r0, m0, 'maciek/xxxxx/topic/command', ... (9 bytes))
1639085754: Sending PUBLISH to maciek_PC MQTT.fx (d0, q0, r0, m0, 'maciek/xxxxx/topic/command', ... (9 bytes))
1639085754: Sending PUBLISH to ID:maciek (d0, q0, r0, m0, 'maciek/xxxxx/topic/command', ... (9 bytes))
1639085754: Received PUBLISH from ID:maciek (d0, q0, r0, m0, 'maciek/xxxxx/topic/response', ... (39 bytes))
1639085754: Sending PUBLISH to maciek_PC MQTT.fx (d0, q0, r0, m0, 'maciek/xxxx/topic/response', ... (39 bytes))
1639085759: Received PUBLISH from maciek_PC MQTT.fx (d0, q0, r0, m0, 'maciek/xxxxx/topic/command', ... (9 bytes))
1639085759: Sending PUBLISH to maciek_PC MQTT.fx (d0, q0, r0, m0, 'maciek/xxxx/topic/command', ... (9 bytes))
1639085759: Sending PUBLISH to ID:maciek (d0, q0, r0, m0, 'maciek/xxxxx/topic/command', ... (9 bytes))
1639085759: [b][u]Socket error on client ID:maciek, disconnecting[/u][/b].
"