Getting start with Arduino ESP8266 certificate generation error

Hello Daria
After writing my reply I found this: Arduino example with server signed certificate?
I tried this code and I succeeded to have the node to contact HiveMQ. But after some time (about a minute) it loses connection again and I get the error:… rc = -2 … When I restart the connectien it will work for a short time. About 10 messages come through.
The problem is, i think, again the certificate. SO Is there an other way to get a valid certificate so I can use the example .ino provided by HiveMQ?