Sharing from my experience to help others:
I'm using secure websocket (wss://), and I experienced repeating disconnections few minutes after the connection was established, with the client dumping
mbedtls error: returned -0x6c00
and the server dumping
Websocket get data error: 18, read (should be 0!): 0
Websocket (wslay) poll error: -400
After researching, I discovered that it happened due to my website being behind a CDN.
I solved it by doing the following:
In the CDN, I configured the DNS so that
www.example.com is proxied but
example.com is DNS-only.
Then, I made sure that all http:// page requests are being redirected from
https://www.example.com (by writing a condition in htaccess file on the server).
In my client, I made sure the websocket url is
And that's it, no more disconnections.