QWebsocket error processing
-
Hello.
I have a question about brocessing error signal from QWebsocket.
Now i do like this:QObject::connect(&myWebsocket, QOverload<QAbstractSocket::SocketError>::of(&QWebSocket::error), this, [this](QAbstractSocket::SocketError) { qDebug() << "websocket error : " << myWebsocket.errorString(); });but when i have error with debug string, i have multiply output like this:
websocket error : "QWebSocketPrivate::processHandshake: Unhandled http status code: 502 (Bad Gateway\r\n)." websocket error : "Invalid statusline in response: <html>\r\n." websocket error : "Invalid statusline in response: <head><title>502 Bad Gateway</title></head>\r\n." websocket error : "Invalid statusline in response: <body bgcolor=\"white\">\r\n." websocket error : "Invalid statusline in response: <center><h1>502 Bad Gateway</h1></center>\r\n." websocket error : "Invalid statusline in response: <hr><center>nginx/1.10.3</center>\r\n." websocket error : "Invalid statusline in response: </body>\r\n." websocket error : "Invalid statusline in response: </html>\r\n."what is the right way to ptocess websocket errors?
in case of error we dont get disconnected signal. If i need to reconnect socket i need to initiate socket closing and reconnecting from error process handler (in my case from lambda)? -
Hello.
I have a question about brocessing error signal from QWebsocket.
Now i do like this:QObject::connect(&myWebsocket, QOverload<QAbstractSocket::SocketError>::of(&QWebSocket::error), this, [this](QAbstractSocket::SocketError) { qDebug() << "websocket error : " << myWebsocket.errorString(); });but when i have error with debug string, i have multiply output like this:
websocket error : "QWebSocketPrivate::processHandshake: Unhandled http status code: 502 (Bad Gateway\r\n)." websocket error : "Invalid statusline in response: <html>\r\n." websocket error : "Invalid statusline in response: <head><title>502 Bad Gateway</title></head>\r\n." websocket error : "Invalid statusline in response: <body bgcolor=\"white\">\r\n." websocket error : "Invalid statusline in response: <center><h1>502 Bad Gateway</h1></center>\r\n." websocket error : "Invalid statusline in response: <hr><center>nginx/1.10.3</center>\r\n." websocket error : "Invalid statusline in response: </body>\r\n." websocket error : "Invalid statusline in response: </html>\r\n."what is the right way to ptocess websocket errors?
in case of error we dont get disconnected signal. If i need to reconnect socket i need to initiate socket closing and reconnecting from error process handler (in my case from lambda)?@Pavel-Romankov said in QWebsocket error processing:
<hr><center>nginx/1.10.3<
It looks like you're connecting to a Nginx server.
Are you sure such installation is providing a Websocket server as well?
You may want to look at this documentation. -
yes, i connect to Nginx server. I get this error from Nginx when backend server isn't running.