From my investigation it appears that the QWebSocketServer works properly only when communicating with the main thread.
Therefore, any messages sent by other threads will not be received at the other side and the socket server will be corrupted from that moment.
In order to fix this issue I actually forced any other thread in my application to send their messages using the main thread.
I did it by using QMetaObject::invokeMethod() with Qt:QueuedConnection as the connection type.
Hope this can help anyone in the future,
Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.