@mistralegna
AFAIK,
You can set bool QAbstractSocket::isValid() const on the given address provided. you can also get error signal from the websocket, if it is not valid address. void QAbstractSocket::error(QAbstractSocket::SocketError socketError). check here .
But , the isvlaid() is not very efficient like in your case WS:// instead of WSS://. Because to my knowledge isValid() says true to any address , if it is inform of address/standard way of address. In your cases, I prefer to use Regular Expression before connection to socket.